Add context null check in oncreate clauses

Tries to fix null pointer excpetions without knowledge of where these empty contexts come from.