Fix a not properly handled pointer comparison that caused UB am: 7f5c6593f2
am: 6ae350fa22

Change-Id: I7abdca3521f1db1c22d03d7492ef14b55e0c42c4