[FIX] NPE in MysqlHWIDProvider

This commit is contained in:
Gravit 2020-06-15 13:23:07 +07:00
parent 5b77e4d8fd
commit a65837d81d
No known key found for this signature in database
GPG key ID: 061981E1E85D3216

View file

@ -72,7 +72,8 @@ private HardwareReportRequest.HardwareInfo fetchHardwareInfo(ResultSet set) thro
HardwareReportRequest.HardwareInfo hardwareInfo = new HardwareReportRequest.HardwareInfo();
hardwareInfo.hwDiskId = set.getString(1);
hardwareInfo.baseboardSerialNumber = set.getString(2);
hardwareInfo.displayId = IOHelper.read(set.getBlob(3).getBinaryStream());
Blob displayId = set.getBlob(3);
hardwareInfo.displayId = displayId == null ? null : IOHelper.read(displayId.getBinaryStream());
hardwareInfo.bitness = set.getInt(4);
hardwareInfo.totalMemory = set.getLong(5);
hardwareInfo.logicalProcessors = set.getInt(6);
@ -90,7 +91,7 @@ public void createHardwareInfo(HardwareReportRequest.HardwareInfo hardwareInfo,
s.setBlob(1, new ByteArrayInputStream(publicKey));
s.setString(2, hardwareInfo.hwDiskId);
s.setString(3, hardwareInfo.baseboardSerialNumber);
s.setBlob(4, new ByteArrayInputStream(hardwareInfo.displayId));
s.setBlob(4, hardwareInfo.displayId == null ? null : new ByteArrayInputStream(hardwareInfo.displayId));
s.setInt(5, hardwareInfo.bitness);
s.setLong(6, hardwareInfo.totalMemory);
s.setInt(7, hardwareInfo.logicalProcessors);