Return gently instead of crashing if mainWindow not found
Part::guiActivateEvent is emitted also when a tab is closed, and when we reach this point due to that event the associated main window cannot be found leading to a crash.
Edited by Simone Gaiarin