Merge "Add a null check for getWindow()"