Skip to content

Commit

Permalink
Close #365: page_software_update: Handle empty response on /firmwareu…
Browse files Browse the repository at this point in the history
…pate request
  • Loading branch information
TheSomeMan committed Dec 28, 2023
1 parent e3d4512 commit f6c0d81
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/page_software_update.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,18 @@ class PageSoftwareUpdate {
const { latest = {}, beta = {} } = data
if (!('version' in latest) || !('url' in latest)) {
console.warn("'latest' object should have 'version' and 'url' properties")
return false
this.#input_fw_update_server_url.setInvalid()
this.#text_fw_update_status_error_desc.setVal('Firmware update info is empty')
this.#div_fw_update_status_error.show()
throw new Error("Server returned incorrect firmware update info")
}
if ((latest.version === '') || (latest.url === '')) {
console.warn("latest.version and latest.url should not be empty")
this.#input_fw_update_server_url.setInvalid()
this.#text_fw_update_status_error_desc.setVal('Firmware update URL is empty or version is empty')
this.#div_fw_update_status_error.show()
this.#sect_advanced.enable()
throw new Error("Server returned incorrect firmware update info")
}
this.#latest_version = latest.version
this.#latest_url = latest.url
Expand Down

0 comments on commit f6c0d81

Please sign in to comment.