Skip to content

Commit

Permalink
fix: Do not allow priorities > 4 in HMS builtin remind
Browse files Browse the repository at this point in the history
  • Loading branch information
MikMuellerDev committed Aug 14, 2023
1 parent 46fadb8 commit 1621734
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/homescript/interpreterBuiltin.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,9 +320,9 @@ func (self interpreterExecutor) GetBuiltinImport(moduleName string, toImport str
dueDateMonth := (*fields["due_date_month"]).(value.ValueInt).Inner
dueDateYear := (*fields["due_date_year"]).(value.ValueInt).Inner

if priority < 1.0 || priority > 5.0 {
if priority < 0.0 || priority > 4.0 || float64(int64(priority)) != float64(priority) {
return nil, value.NewRuntimeErr(
fmt.Sprintf("Reminder urgency has to be 0 < and < 6, got %d", int(priority)),
fmt.Sprintf("Reminder urgency has to an integer ( where 0 <= urgency <= 4 ), got %d", int(priority)),
value.ValueErrorKind,
span,
)
Expand Down

0 comments on commit 1621734

Please sign in to comment.