Check if focused window is null to prevent NPE

Change-Id: I87926d4df9fb1ba7f68805ef32d9354643bdbd1a
Add missing bracket

Change-Id: I32c111a58db873e46de93f009e45e649737e8054
Merge remote-tracking branch 'sgt7/cm-10.2' into cm-10.2-sgt7