Merge "Fix NPE due to delayed event handling."