Skip to content

Commit

Permalink
Fixup offline script execution
Browse files Browse the repository at this point in the history
In case of networking error, the local version is now launched properly,
if any exists.
  • Loading branch information
Farigh committed Aug 19, 2022
2 parents 403687d + 156b01b commit 979eb9b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ class PokeclickerAutomationUpdater
}).on('error', (e) =>
{
console.warn("Check for pokeclicker automation update failed.");

if (this.getCurrentVersion() != "")
{
console.info("Running the local version of the automation.");

// No update needed, run the automation right away
this.runAutomation();
}
});
}

Expand Down Expand Up @@ -130,7 +138,7 @@ class PokeclickerAutomationUpdater
static isNewerVersionAvailable(latestSha1)
{
console.info(`\n\nCurrent sha1: ${this.getCurrentVersion()}\nLatest sha1: ${latestSha1}\n\n`);
return this.getCurrentVersion() != latestSha1;
return (latestSha1 != "") && (this.getCurrentVersion() != latestSha1);
}
}

Expand Down

0 comments on commit 979eb9b

Please sign in to comment.