QmlJS: Fix potential null pointer access.

Change-Id: Ib3e6256343e912a0af4e9618d0f17e1075b94ff0
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@theqtcompany.com>