Skip to content

Commit

Permalink
Fix webview error when no pythonRadioButtons are present
Browse files Browse the repository at this point in the history
  • Loading branch information
will-v-pi committed Aug 27, 2024
1 parent d931311 commit 385ad93
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions web/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -502,14 +502,17 @@ var isPicoWireless = false;
var ninjaRadioButtons = document.querySelectorAll('input[name="ninja-version-radio"]');
var cmakeRadioButtons = document.querySelectorAll('input[name="cmake-version-radio"]');

// Check if the first radio button is selected and disabled
if (pythonRadioButtons[0].checked && pythonRadioButtons[0].disabled) {
// Find the first non-disabled radio button
for (var i = 1; i < pythonRadioButtons.length; i++) {
if (!pythonRadioButtons[i].disabled) {
// Select the first non-disabled radio button
pythonRadioButtons[i].checked = true;
break;
// Don't check if no pythonRadioButtons, eg on Linux
if (pythonRadioButtons.length > 0) {
// Check if the first radio button is selected and disabled
if (pythonRadioButtons[0].checked && pythonRadioButtons[0].disabled) {
// Find the first non-disabled radio button
for (var i = 1; i < pythonRadioButtons.length; i++) {
if (!pythonRadioButtons[i].disabled) {
// Select the first non-disabled radio button
pythonRadioButtons[i].checked = true;
break;
}
}
}
}
Expand Down

0 comments on commit 385ad93

Please sign in to comment.