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

Exception when compiling program w/o opt_attribs #31

Closed
Olliebrown opened this issue Dec 17, 2016 · 2 comments
Closed

Exception when compiling program w/o opt_attribs #31

Olliebrown opened this issue Dec 17, 2016 · 2 comments

Comments

@Olliebrown
Copy link

Olliebrown commented Dec 17, 2016

The version on the main web page and downloaded as the latest release has a bug where it raises an exception when you try to compile a program without providing the 'opt_attribs'

To reproduce: open the tiny.js example and notice it does not work.

Problem seems to be around twgl.js:1823:

} else if (!Array.isArray(opt_attribs)) { var options = opt_attribs;
opt_errorCallback = options.errorCallback;
opt_attrib = options.attribLocations;
}

Quick fix is to check that opt_attribs is defined before checking if it is an array:

} else if (opt_attribs && !Array.isArray(opt_attribs)) {
var options = opt_attribs;
opt_errorCallback = options.errorCallback;
opt_attribs = options.attribLocations;
}

Also, notice that the last line of the conditional block referenced 'opt_attrib' w/o an 's' which I think is a type-o. I assume it should be 'opt_attribs'

@Olliebrown
Copy link
Author

Note, the relevant line in the src is in programs.js:435:

} else if (!Array.isArray(opt_attribs)) {
var options = opt_attribs;
opt_errorCallback = options.errorCallback;
opt_attrib = options.attribLocations;
}

@greggman
Copy link
Owner

Sorry about that. I think it's fixed now.

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