Display "Invalid hardware configuration" when the hardware configuration area is uninitialized instead of a general error message. Improves #623.

This commit is contained in:
László Monda
2018-05-19 13:38:16 +02:00
parent 091796d13c
commit 3c056a7255

View File

@@ -41,16 +41,20 @@ export class HardwareConfiguration {
} }
fromBinary(buffer: UhkBuffer): HardwareConfiguration { fromBinary(buffer: UhkBuffer): HardwareConfiguration {
this.signature = buffer.readString(); try {
this.majorVersion = buffer.readUInt8(); this.signature = buffer.readString();
this.minorVersion = buffer.readUInt8(); this.majorVersion = buffer.readUInt8();
this.patchVersion = buffer.readUInt8(); this.minorVersion = buffer.readUInt8();
this.brandId = buffer.readUInt8(); this.patchVersion = buffer.readUInt8();
this.deviceId = buffer.readUInt8(); this.brandId = buffer.readUInt8();
this.uniqueId = buffer.readUInt32(); this.deviceId = buffer.readUInt8();
this.isVendorModeOn = buffer.readBoolean(); this.uniqueId = buffer.readUInt32();
this.isIso = buffer.readBoolean(); this.isVendorModeOn = buffer.readBoolean();
return this; this.isIso = buffer.readBoolean();
return this;
} catch (e) {
throw new Error('Invalid hardware configuration');
}
} }
toJsonObject(): any { toJsonObject(): any {