Skip to content

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

@harryfear

Description

@harryfear

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions