Skip to content

Don't crash if a callback doesn't return an expected array of values

Marco Trevisan requested to merge 3v1n0/gjs:callback-guard-wrong-return into master

When a function returns multiple values, we expect to have an array, however gjs doesn't do any strong check on this and we just assume that JS just returned us an array, and this may lead to a crash when calling JS_GetElement on an value that isn't an object or an array.

So, check if that the JS function just returned us an array, and warn in case this didn't happen.


Without this the added tests would have lead to a crash when we had multiple values

Merge request reports