diff --git a/androidgcs/src/org/openpilot/androidgcs/fragments/SystemAlarmsFragment.java b/androidgcs/src/org/openpilot/androidgcs/fragments/SystemAlarmsFragment.java index e311e7249..1bcbfee63 100644 --- a/androidgcs/src/org/openpilot/androidgcs/fragments/SystemAlarmsFragment.java +++ b/androidgcs/src/org/openpilot/androidgcs/fragments/SystemAlarmsFragment.java @@ -30,6 +30,7 @@ import org.openpilot.uavtalk.UAVObject; import org.openpilot.uavtalk.UAVObjectField; import org.openpilot.uavtalk.UAVObjectManager; +import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; @@ -72,7 +73,16 @@ public class SystemAlarmsFragment extends ObjectManagerFragment { if (DEBUG) Log.d(TAG, "Updated"); if (obj.getName().compareTo("SystemAlarms") == 0) { + Activity activity = getActivity(); + if (activity == null) { + // TODO: Need to unregister all the callbacks + return; + } TextView alarms = (TextView) getActivity().findViewById(R.id.system_alarms_fragment_field); + if (alarms == null) { + // TODO: Need to figure out how to unregister all the callbacks + return; + } UAVObjectField a = obj.getField("Alarm"); List names = a.getElementNames(); String contents = new String();