From 8382253010267b93c9aeffc769e3f5e43d698094 Mon Sep 17 00:00:00 2001
From: Matthieu Herrb <matthieu@herrb.eu>
Date: Mon, 30 Aug 2021 21:47:09 +0200
Subject: [PATCH] Avoid NULL pointer deref. Fixes issue #47.

Signed-off-by: Matthieu Herrb <matthieu@herrb.eu>
---
 modules/om/generic/omTextEsc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/om/generic/omTextEsc.c b/modules/om/generic/omTextEsc.c
index df1fb10c..2aaff73d 100644
--- a/modules/om/generic/omTextEsc.c
+++ b/modules/om/generic/omTextEsc.c
@@ -169,10 +169,10 @@ TextWidthWithFontSet(
 	 *
 	 */
 
-	if(fd == (FontData) NULL ||
-	   (font = font_set->font) == (XFontStruct *) NULL) {
+	if((font = font_set->font) == (XFontStruct *) NULL) {
 
-	    if((font = fd->font) == (XFontStruct *) NULL)
+	    if(fd == (FontData) NULL ||
+	       (font = fd->font) == (XFontStruct *) NULL)
 		break;
 	}
 
-- 
GitLab