From fe59d854d567311760c82418bef9ceb7fe9231c5 Mon Sep 17 00:00:00 2001 From: Oblarg Date: Mon, 15 Jul 2019 21:20:11 -0400 Subject: [PATCH] Notifier: add null check (#1684) --- wpilibj/src/main/java/edu/wpi/first/wpilibj/Notifier.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Notifier.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Notifier.java index 45b7d94b46..e1d6bb69b3 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Notifier.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Notifier.java @@ -1,5 +1,5 @@ /*----------------------------------------------------------------------------*/ -/* Copyright (c) 2016-2018 FIRST. All Rights Reserved. */ +/* Copyright (c) 2016-2019 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ @@ -12,6 +12,8 @@ import java.util.concurrent.locks.ReentrantLock; import edu.wpi.first.hal.NotifierJNI; +import static java.util.Objects.requireNonNull; + public class Notifier implements AutoCloseable { // The thread waiting on the HAL alarm. private Thread m_thread; @@ -85,6 +87,8 @@ public class Notifier implements AutoCloseable { * using StartSingle or StartPeriodic. */ public Notifier(Runnable run) { + requireNonNull(run); + m_handler = run; m_notifier.set(NotifierJNI.initializeNotifier());