From a23861332aad80bc62a1552d7fe2d081b2a40999 Mon Sep 17 00:00:00 2001
From: Peter Zmanovsky <48548636+peter15914@users.noreply.github.com>
Date: Thu, 19 Dec 2024 12:26:32 +0500
Subject: [PATCH] Check NULL from abspath()

abspath() returns NULL in some cases and its return value is always checked for NULL.
---
 src/nnn.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/nnn.c b/src/nnn.c
index b1052f9c..bffc8f0d 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -8759,6 +8759,11 @@ int main(int argc, char *argv[])
 
 				close(fd);
 				selpath = abspath(optarg, NULL, NULL);
+				if (!selpath) {
+					xerror();
+					return EXIT_FAILURE;
+				}
+
 				unlink(selpath);
 			}
 			break;