Check if context creation was successful before accessing it