Fix crash with registration of null and non-QML constructed objects


There was an assumption that QML context existed for passed in object
which caused a crash when the object wasn't constructed in QML engine or
if null was passed.

Fixes: QTBUG-141648
Pick-to: 6.10 6.8 6.5
Change-Id: I9ec938c6450f100736988bb94c58523d2c958901
Reviewed-by: Arno Rehn <a.rehn@menlosystems.com>
commitd98fbfd9e9645d9b1f1433178f1ea174515f4155
parent5deddc344a1c119e24f3aef8ece0e361788b233c
authorJoni Poikelin <joni.poikelin@qt.io>
committerJoni Poikelin <joni.poikelin@qt.io>
commit timeTue, 4 Nov 2025 14:59:56 +0200