Don't crash if child window is shown before parent window

Change-Id: I1989012000ea1189fc823f42ef3fd7cee6606c72