fix null object reference
This commit is contained in:
parent
b69dc35716
commit
ce7cddc1da
2 changed files with 16 additions and 9 deletions
|
@ -37,7 +37,7 @@
|
||||||
<ConfirmationsSetting value="0" id="Add" />
|
<ConfirmationsSetting value="0" id="Add" />
|
||||||
<ConfirmationsSetting value="0" id="Remove" />
|
<ConfirmationsSetting value="0" id="Remove" />
|
||||||
</component>
|
</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" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectType">
|
<component name="ProjectType">
|
||||||
|
|
|
@ -432,14 +432,19 @@ public class ConfigBuilderFragment extends Fragment implements PluginBase, PumpI
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public JSONObject getJSONStatus() {
|
public JSONObject getJSONStatus() {
|
||||||
return activePump.getJSONStatus();
|
if (activePump != null)
|
||||||
|
return activePump.getJSONStatus();
|
||||||
|
else return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String deviceID() {
|
public String deviceID() {
|
||||||
return activePump.deviceID();
|
if (activePump != null)
|
||||||
|
return activePump.deviceID();
|
||||||
|
else return "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -881,7 +886,7 @@ public class ConfigBuilderFragment extends Fragment implements PluginBase, PumpI
|
||||||
public void onStatusEvent(final EventNewBG ev) {
|
public void onStatusEvent(final EventNewBG ev) {
|
||||||
// Give some time to Loop
|
// Give some time to Loop
|
||||||
try {
|
try {
|
||||||
Thread.sleep(120* 1000L);
|
Thread.sleep(120 * 1000L);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -1015,13 +1020,15 @@ public class ConfigBuilderFragment extends Fragment implements PluginBase, PumpI
|
||||||
deviceStatus.enacted.put("requested", requested);
|
deviceStatus.enacted.put("requested", requested);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
deviceStatus.device = "openaps://" + getActivePump().deviceID();
|
if (getActivePump() != null) {
|
||||||
deviceStatus.pump = getActivePump().getJSONStatus();
|
deviceStatus.device = "openaps://" + getActivePump().deviceID();
|
||||||
|
deviceStatus.pump = getActivePump().getJSONStatus();
|
||||||
|
|
||||||
deviceStatus.created_at = DateUtil.toISOString(new Date());
|
deviceStatus.created_at = DateUtil.toISOString(new Date());
|
||||||
|
|
||||||
deviceStatus.sendToNSClient();
|
deviceStatus.sendToNSClient();
|
||||||
lastDeviceStatusUpload = new Date();
|
lastDeviceStatusUpload = new Date();
|
||||||
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue