fix null object reference
This commit is contained in:
parent
b69dc35716
commit
ce7cddc1da
|
@ -37,7 +37,7 @@
|
|||
<ConfirmationsSetting value="0" id="Add" />
|
||||
<ConfirmationsSetting value="0" id="Remove" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
|
|
@ -432,14 +432,19 @@ public class ConfigBuilderFragment extends Fragment implements PluginBase, PumpI
|
|||
return result;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public JSONObject getJSONStatus() {
|
||||
if (activePump != null)
|
||||
return activePump.getJSONStatus();
|
||||
else return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String deviceID() {
|
||||
if (activePump != null)
|
||||
return activePump.deviceID();
|
||||
else return "Unknown";
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1015,6 +1020,7 @@ public class ConfigBuilderFragment extends Fragment implements PluginBase, PumpI
|
|||
deviceStatus.enacted.put("requested", requested);
|
||||
}
|
||||
}
|
||||
if (getActivePump() != null) {
|
||||
deviceStatus.device = "openaps://" + getActivePump().deviceID();
|
||||
deviceStatus.pump = getActivePump().getJSONStatus();
|
||||
|
||||
|
@ -1022,6 +1028,7 @@ public class ConfigBuilderFragment extends Fragment implements PluginBase, PumpI
|
|||
|
||||
deviceStatus.sendToNSClient();
|
||||
lastDeviceStatusUpload = new Date();
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue