ref(rect): dont throw if matrix is null (#46675)
I set the canvas so 0 width and height which reproduced the crash, after
this fix everything worked, except profile GL code did not render
anything which is expected, but the rest of the UI did not break