Skip to content

Commit

Permalink
Fixes #5: empty script argument causes type error
Browse files Browse the repository at this point in the history
  • Loading branch information
rik-rosseel committed Apr 6, 2023
1 parent 7fab5b3 commit 72f5cdc
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions LaunchSchedule.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const dateFormat = isMEDateFormat ? "HH:mm MM/dd" : "HH:mm dd/MM";
*/
const launchCountLimit = isOnMacOS ? 5 : 6;
// WIDGET SIZES
const sizes = ["Small", "Medium", "Large"];
const sizes = ["small", "medium", "large"];

// Root ListWidget
let widget = new ListWidget();
Expand Down Expand Up @@ -99,9 +99,12 @@ if (config.runsInApp) {
}
// Or in the widget
else if (config.runsInWidget) {
let sizeArg = args.widgetParameter.replace(/\s/g, '');
sizeArg = sizeArg[0].toUpperCase() + sizeArg.substring(1);
let size = sizes.indexOf(sizeArg);
let sizeArg = args.widgetParameter
let size = -1;
if (sizeArg) {
sizeArg.replace(/\s/g, '').toLowerCase();
size = sizes.indexOf(sizeArg);
}
if (size == -1) {
buildInvalidParamWidget(widget);
widget.presentSmall();
Expand Down

0 comments on commit 72f5cdc

Please sign in to comment.