-
Notifications
You must be signed in to change notification settings - Fork 2
WEBDEV-8711 add type check and value conversion at the top of the function #71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -155,6 +155,8 @@ export class IAOTPInput extends LitElement { | |
| * Submits the result if enough characters are filled. | ||
| */ | ||
| private fillInputs(value: string) { | ||
| if (typeof value !== 'string') value = String(value ?? ''); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This coerces anything, not just numbers. if (typeof value === 'number') value = String(value);
if (typeof value !== 'string') return;Also Q: was the number case the actual intent here, or just the easiest thing to test? |
||
|
|
||
| if (value === '') this.clearInputs(); | ||
|
|
||
| const charsToFill = value | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This covers the one path that never crashed. The reported error is
handleInputreadinge.dataoffbeforeinput, notprefillValue. If we're hardening against a non-string reachingfillInputs, worth firing abeforeinputwith a non-stringdatatoo: