Zway-Bot [v1.7.1] Tiny fix for nullpointer exception

This commit is contained in:
BlubbFish 2018-09-29 18:13:17 +00:00
parent af7eeeaf15
commit 35aadc09cf
3 changed files with 15 additions and 7 deletions

View File

@ -31,11 +31,19 @@ namespace BlubbFish.IoT.Zway.Devices.CommandClasses {
}
private void InitComplex(JsonData json) {
if (json.Keys.Contains("data") && json["data"].Keys.Contains("V1event") &&
json["data"]["V1event"].Keys.Contains("alarmType") && json["data"]["V1event"]["alarmType"].Keys.Contains("value") &&
json["data"]["V1event"].Keys.Contains("level") && json["data"]["V1event"]["level"].Keys.Contains("value")) {
this.AlarmType = Int32.Parse(json["data"]["V1event"]["alarmType"]["value"].ToString());
this.Level = Int32.Parse(json["data"]["V1event"]["level"]["value"].ToString());
if (json.Keys.Contains("data") && json["data"].Keys.Contains("V1event")) {
if(json["data"]["V1event"].Keys.Contains("alarmType") &&
json["data"]["V1event"]["alarmType"].Keys.Contains("value") &&
json["data"]["V1event"]["alarmType"]["value"] != null &&
json["data"]["V1event"]["alarmType"]["value"].IsInt) {
this.AlarmType = Int32.Parse(json["data"]["V1event"]["alarmType"]["value"].ToString());
}
if(json["data"]["V1event"].Keys.Contains("level") &&
json["data"]["V1event"]["level"].Keys.Contains("value") &&
json["data"]["V1event"]["level"]["value"] != null &&
json["data"]["V1event"]["level"]["value"].IsInt) {
this.Level = Int32.Parse(json["data"]["V1event"]["level"]["value"].ToString());
}
}
}
#endregion

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.5.0")]
[assembly: AssemblyFileVersion("1.5.0")]
[assembly: AssemblyVersion("1.5.1")]
[assembly: AssemblyFileVersion("1.5.1")]

Binary file not shown.