Closed CatchABus closed 8 months ago
In the case of properties or methods that accept string values like measureText
in browser environment, non-string values will be converted to string.
A call of ctx.measureText(null).width
will return 46.69921875
as null
gets treated as "null"
.
{N} canvas throws NPEs for those too though.
Fixed in v2
It seems canvas 2D doesn't handle null values like browser. In my case, I use a plugin that sets value to
shadowColor
even if that value is null.In browser, null assignments are usually ignored but {N} canvas throws exception:
How plugin setters work now:
How they actually behave in browser:
A sample with
shadowColor
to confirm this: https://jsfiddle.net/k8ums9ra/