From a65837d81d8666e74fe9552960336e5f477ff269 Mon Sep 17 00:00:00 2001 From: Gravit Date: Mon, 15 Jun 2020 13:23:07 +0700 Subject: [PATCH] [FIX] NPE in MysqlHWIDProvider --- .../launchserver/auth/protect/hwid/MysqlHWIDProvider.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/hwid/MysqlHWIDProvider.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/hwid/MysqlHWIDProvider.java index 623593b0..426707bf 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/hwid/MysqlHWIDProvider.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/protect/hwid/MysqlHWIDProvider.java @@ -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);