Fix segfault when loading .kra file with a ref pic
There was a crash caused by not checking if anything is on the reference
images layer before updating it. This commit fixes this behaviour.
Reference images should still load just fine.
BUG:408927