flush
[m6w6/ext-psi] / src / validator.c
index 7222a57f16e42919e91c4422f1621602b63f8edf..44ea4ab11c2108385636c3707431dd6fa7e6aaef 100644 (file)
@@ -117,7 +117,7 @@ static inline int validate_decl_func(PSI_Validator *V, decl *decl, decl_arg *fun
                return 0;
        }
 
-       decl->dlptr = dlsym(V->dlopened, func->var->name);
+       decl->dlptr = dlsym(V->dlopened ?: RTLD_NEXT, func->var->name);
        if (!decl->dlptr) {
                V->error(PSI_WARNING, "Failed to located symbol '%s': %s",
                        func->var->name, dlerror());
@@ -282,7 +282,7 @@ static inline int validate_impl_stmts(PSI_Validator *V, impl *impl, impl_stmts *
                let_stmt *let = stmts->let.list[i];
                int check = 0;
 
-               if (let->val->var) {
+               if (let->val && let->val->var) {
                        for (j = 0; j < impl->func->args->count; ++j) {
                                impl_arg *iarg = impl->func->args->args[j];