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

Check for null when using UriResolverExtensionFileReader to read wasm module #1317

Merged
merged 8 commits into from
Oct 11, 2022

Conversation

krisbitney
Copy link
Contributor

@krisbitney krisbitney commented Oct 11, 2022

When a Wasm wrapper dev tries to invoke an interface in their wrapper, an error isn't thrown in the wasm-js package. Instead of returning a UInt8Array containing a Wasm pacakge, the _getWasmModule method in WasmWrapper.ts returns null. The null value is passed around until a null pointer exception is thrown when trying to call indexOf on it in the indexOfArray method in utils.ts in the asyncify-js package.

The null value arrises because the UriResolverExtensionFileReader in the uri-resolver-extensions package wants to return a UInt8Array or an error. However, thegetFile method of the uri resolver interface returns Bytes | null. All of the uri resolver implementations return null on failure. So we need to check that the retrieved file data is not null.

@krisbitney krisbitney requested a review from nerfZael October 11, 2022 12:00
@krisbitney krisbitney changed the title Trigger error in WasmWrapper.ts when trying to invoke interface Check for null when using UriResolverExtensionFileReader to read wasm module Oct 11, 2022
dOrgJelli
dOrgJelli previously approved these changes Oct 11, 2022
Copy link
Contributor

@dOrgJelli dOrgJelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great find!

@dOrgJelli dOrgJelli merged commit b2f303a into origin-dev Oct 11, 2022
@krisbitney krisbitney deleted the invoke-interface-error branch January 6, 2023 06:24
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

Successfully merging this pull request may close these issues.

3 participants