Use a crash-safe firstObject on window in case it's nil