Skip to content
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

Error when evaluating 't.indexOf' in webp-hero.bundle.js #53

Open
harryfear opened this issue Sep 7, 2024 · 1 comment
Open

Error when evaluating 't.indexOf' in webp-hero.bundle.js #53

harryfear opened this issue Sep 7, 2024 · 1 comment

Comments

@harryfear
Copy link

Description
I encountered a runtime error in the webp-hero library that seems to stem from the use of the indexOf method on a null object. The error message is:

null is not an object (evaluating 't.indexOf')

This occurs when trying to process WebP images using the library.

Steps to Reproduce
(1) Include the webp-hero library from unpkg:

<script src="https://unpkg.com/[email protected]/dist-cjs/webp-hero.bundle.js"></script>

(2) Attempt to decode a WebP image (specific steps that lead to the issue would be helpful here, including any relevant code snippets).

Expected Behavior
The library should either successfully process the WebP image or handle the error more gracefully if the data isn't as expected.

Actual Behavior
The script fails with a TypeError due to attempting to call .indexOf on a null object, causing script execution to halt.

Possible Solution
It might be beneficial to check if the variable is null or undefined before attempting to access .indexOf. This could be a simple null check or a more comprehensive error handling update in the library.

@chase-moskal
Copy link
Owner

hello @harryfear, thanks for submitting the issue -- i'm afraid i don't have time to prioritize fixing this issue myself, but i can try to be available to help, and review and merge a fix if one is offered as a pull request.

i did a search for indexOf on the webp-hero codebase here: https://github.com/search?q=repo%3Achase-moskal%2Fwebp-hero%20indexOf&type=code

the search reveals only a handful of places where indexOf is used, so that's a good lead to get us started.

perhaps yourself, or anybody else experiencing this issue, can offer an example to reproduce the issue -- perhaps it's a specific webp image file, or a specific method of inserting it onto the page?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants