Add optional chaining to 'name' in getExtension#238
Open
yuval-a wants to merge 1 commit intostackgl:masterfrom
Open
Add optional chaining to 'name' in getExtension#238yuval-a wants to merge 1 commit intostackgl:masterfrom
yuval-a wants to merge 1 commit intostackgl:masterfrom
Conversation
This fixes a bug when a name can be 'null' and an exception will be thrown when calling 'getSupportedExtensions()'. This happened to me when using 'gpu.js' - which has this as a dependency. |
Member
|
Hi @yuval-a. Do you know under which circumstances |
Author
|
Hey Daniel.
To reproduce this:
npm install gpu.js (a popular general GPU programming library).
run this:
const gl = require('gl')(1, 1);
let exts = gl.getSupportedExtensions();
console.log (exts);
You will get an exception in gl that the name of an extension is undefined.
I am not sure if this is a version issue - the package.json of gpu.js has
an older version (4.x.x) as a dependency -
however - when I set it to latest (6.0.1) - and reinstall - it still
happens.
BUT - if I just open a new project - and do npm install for gl - and run
the code - this error does not happen -
I'm not entirely sure why this happens - perhaps gpu.js has some code that
explicitly changes something in the gl module "from outside"...
Anyway, this fixes it for that.
Yuval.
…On Fri, 21 Oct 2022 at 23:37, Daniel Hritzkiv ***@***.***> wrote:
Hi @yuval-a <https://github.com/yuval-a>.
Do you know under which circumstances getExtension is called without a
value? Calling getExtension without an argument may be a bug in your code.
—
Reply to this email directly, view it on GitHub
<#238 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAE5ZASBLJ5HWRIOWCQRKITWEL5H7ANCNFSM6AAAAAARLOT55E>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Member
|
Hmm. I cannot reproduce this myself, even after installing gpu.js. I'm running this in nodejs on macOS. What about you? In either case, I would suggest debugging this problem further by stepping through the code to find what calls |
Author
|
Haven’t tried on macOS, just on Windows. Could be related…
|
Member
|
Could be. Still, it would helpful for you to step through the code and find where |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes a bug when a name can be 'null' and an exception will be thrown when calling 'getSupportedExtensions()'. This happened to me when using 'gpu.js' - which has this as a dependency. |