[FIX] Исправлена проблема с NPE при HWID compareMode

This commit is contained in:
Gravit 2019-03-12 17:38:22 +07:00
parent b16cd0cc67
commit 5ad5795a62
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
2 changed files with 2 additions and 1 deletions

View file

@ -151,6 +151,7 @@ public void onCheckInfo(OshiHWID hwid, String username, Connection c) throws HWI
db_hwid.processorID = set.getString(hwidFieldProcessorID); db_hwid.processorID = set.getString(hwidFieldProcessorID);
db_hwid.HWDiskSerial = set.getString(hwidFieldHWDiskSerial); db_hwid.HWDiskSerial = set.getString(hwidFieldHWDiskSerial);
db_hwid.totalMemory = Long.valueOf(set.getString(hwidFieldTotalMemory)); db_hwid.totalMemory = Long.valueOf(set.getString(hwidFieldTotalMemory));
db_hwid.macAddr = "";
LogHelper.dev("Compare HWID: %s vs %s", hwid.getSerializeString(), db_hwid.getSerializeString()); LogHelper.dev("Compare HWID: %s vs %s", hwid.getSerializeString(), db_hwid.getSerializeString());
int compare_point = hwid.compare(db_hwid); int compare_point = hwid.compare(db_hwid);
if(compare_point < compare) continue; if(compare_point < compare) continue;

View file

@ -43,7 +43,7 @@ public int compare(HWID hwid) {
if(oshi.HWDiskSerial.equals(HWDiskSerial)) rate+=45; if(oshi.HWDiskSerial.equals(HWDiskSerial)) rate+=45;
if(oshi.processorID.equals(processorID)) rate+=18; if(oshi.processorID.equals(processorID)) rate+=18;
if(oshi.serialNumber.equals(serialNumber)) rate+=15; if(oshi.serialNumber.equals(serialNumber)) rate+=15;
if(oshi.macAddr.equals(macAddr)) rate+=19; if(!oshi.macAddr.isEmpty() && oshi.macAddr.equals(macAddr)) rate+=19;
return rate; return rate;
} }
return 0; return 0;