diff --git a/usr.sbin/pkg_install/delete/perform.c b/usr.sbin/pkg_install/delete/perform.c index 1e40db6d2f6a..1da3ad70e0ad 100644 --- a/usr.sbin/pkg_install/delete/perform.c +++ b/usr.sbin/pkg_install/delete/perform.c @@ -266,7 +266,7 @@ pkg_do(char *pkg) for (p = Plist.head; p ; p = p->next) { if (p->type != PLIST_PKGDEP) continue; - deporigin = (p->next->type == PLIST_DEPORIGIN) ? p->next->name : + deporigin = (p->next != NULL && p->next->type == PLIST_DEPORIGIN) ? p->next->name : NULL; if (Verbose) { printf("Trying to remove dependency on package '%s'", p->name);