Merge "Add NPE check before stopping profiler"