From d171545f185579f46d95bb4a7996e7651848bde5 Mon Sep 17 00:00:00 2001 From: HorizonCode Date: Sun, 21 Jul 2024 21:48:44 +0200 Subject: [PATCH] fix hwid error --- electron/hwidUtil.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/electron/hwidUtil.js b/electron/hwidUtil.js index e1e6055..71c9afc 100644 --- a/electron/hwidUtil.js +++ b/electron/hwidUtil.js @@ -25,12 +25,16 @@ const defaultHWID = "recorderinthesandybridge"; */ function getHwId() { return new Promise((resolve) => { - const getter = platforms[process.platform]; - if (getter) { - const result = getter[1].exec(child_process.execSync(getter[0], options)); - if (result) resolve(crypto.createHash("md5").update(result[1]).digest("hex")); + try { + const getter = platforms[process.platform]; + if (getter) { + const result = getter[1].exec(child_process.execSync(getter[0], options)); + if (result) resolve(crypto.createHash("md5").update(result[1]).digest("hex")); + } + resolve(crypto.createHash("md5").update(defaultHWID).digest("hex")); + } catch { + resolve(crypto.createHash("md5").update(defaultHWID).digest("hex")); } - resolve(crypto.createHash("md5").update(defaultHWID).digest("hex")); }) } exports.getHwId = getHwId;