fixed segfault, nullcheck in the ast_if typecheck