Skip to content

Sandbox crash when lvlX_slots_expended is NaN (easy fix) #1410

@ooshhub

Description

@ooshhub

5e Companion

As per this Roll20 thread, non-numeric values in lvlX_slots_expended will cause the resolveslot() function to crash the API sandbox. The issue is with HTML's handling of number inputs, largely with whitespace as the error is invisible to the user, but the attribute value becomes an empty string.
An easy solution would be to change line 320, the .set() operation, to check for isNaN:
if (!isNaN(spent)) charslot.set({current: Math.max(spent - 1, 0)});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions