Nil check fix #1394

@Kartones CR this please