layers: MR181/GL102 Fix unique_objects to correctly assign local vars under ptrs

If a variable that needs to be restored is below a ptr, then need to declare
it at the top level, but only assign it if the ptr(s) that it's below are
non-null.
1 file changed