FIx NPE in InstanceMetricAlarmAssertWorker (#1614)

* add user

* add user

* FIx NPE in InstanceMetricAlarmAssertWorker
This commit is contained in:
caoyixiong 2018-08-31 18:09:07 +08:00 committed by 彭勇升 pengys
parent cfee02cbf5
commit 9275eeaa7a
1 changed files with 1 additions and 1 deletions

View File

@ -66,7 +66,7 @@ public class InstanceMetricAlarmAssertWorker extends AlarmAssertWorker<InstanceM
Instance instance = instanceDAO.getInstance(alarm.getInstanceId());
JsonObject osInfo = gson.fromJson(instance.getOsInfo(), JsonObject.class);
String serverName = Const.UNKNOWN;
if (osInfo.has("hostName")) {
if (osInfo != null && osInfo.has("hostName")) {
serverName = osInfo.get("hostName").getAsString();
}