Fix a null dereference

Thanks @Oppen for spotting it