fix crash when XOpenIM returns NULL