Check if context creation was successful before accessing it
Merge pull request #2745 from Daft-Freak/patch-3

Check if context creation was successful before accessing it