From d747bf045ea20b0cb5813a83c13bdfb4ca424699 Mon Sep 17 00:00:00 2001
From: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Mon, 14 Mar 2022 14:20:56 +0100
Subject: [PATCH] Prevent NULL deref in rpmfsGetStates()

---
 lib/rpmfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/rpmfs.c b/lib/rpmfs.c
index 84887a0..5f91cd2 100644
--- a/lib/rpmfs.c
+++ b/lib/rpmfs.c
@@ -98,7 +98,7 @@ rpmfileState rpmfsGetState(rpmfs fs, unsigned int ix)
 
 rpm_fstate_t * rpmfsGetStates(rpmfs fs)
 {
-    return fs->states;
+    return (fs != NULL) ? fs->states : NULL;
 }
 
 rpmFileAction rpmfsGetAction(rpmfs fs, unsigned int ix)
-- 
1.8.3.1

