$wgOut->getContext()->getTitle() may return null

We should just check if it's null before using it as a title object

Change-Id: Ieaf7adb3fccc62c79a6eaad5650840cc5411873e