Merge "Fix potential null error in clearEvents." into sc-dev