Fixed nullptr dereference in GPU code