fix #42231: crash on delete all measures if frame present

Check for null pointer.  Not sure if there is something in particular we should be doing if so, but doing nothing seems to work.