patch 9.1.1378: sign without text overwrites number option

Problem:  When 'signcolumn' is set to `number` but a line has a sign
          without text, the line number disappears (finite-state-machine)
Solution: Verify that a sign actually contains text before rendering the
          line number (glepnir)

fixes: #17169
closes: #17282

Signed-off-by: glepnir <glephunter@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/drawline.c b/src/drawline.c
index a14dd90..57ee9a5 100644
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -388,7 +388,8 @@
 	// If 'signcolumn' is set to 'number' and a sign is present
 	// in 'lnum', then display the sign instead of the line
 	// number.
-	if ((*wp->w_p_scl == 'n' && *(wp->w_p_scl + 1) == 'u') && sign_present)
+	if ((*wp->w_p_scl == 'n' && *(wp->w_p_scl + 1) == 'u') && sign_present
+		&& wlv->sattr.sat_text != NULL)
 	    get_sign_display_info(TRUE, wp, wlv);
 	else
 #endif
diff --git a/src/testdir/dumps/Test_sign_number_without_signtext.dump b/src/testdir/dumps/Test_sign_number_without_signtext.dump
new file mode 100644
index 0000000..0cf55bd
--- /dev/null
+++ b/src/testdir/dumps/Test_sign_number_without_signtext.dump
@@ -0,0 +1,5 @@
+| +0#ffffff16#ff404010|>@1| >a+0#0000000#ffffff0| @69
+| +0#ffffff16#ff404010@1|2| |b+0#0000000#ffffff0| @69
+| +0#af5f00255&@1|3| |c+0#0000000&| @69
+|~+0#4040ff13&| @73
+| +0#0000000&@56|1|,|1| @10|A|l@1| 
diff --git a/src/testdir/test_signs.vim b/src/testdir/test_signs.vim
index 8304298..e66e6fa 100644
--- a/src/testdir/test_signs.vim
+++ b/src/testdir/test_signs.vim
@@ -2103,4 +2103,23 @@
   eval test_null_list()->sign_unplacelist()
 endfunc
 
+func Test_sign_number_without_signtext()
+  CheckScreendump
+  CheckRunVimInTerminal
+
+  let lines =<< trim END
+      set number signcolumn=number
+      call setline(1, ['a', 'b', 'c'])
+      sign define SignA text=>> texthl=Search numhl=Error
+      sign define SignB numhl=Error
+      sign place 1 line=1 name=SignA buffer=1
+      sign place 2 line=2 name=SignB  buffer=1
+  END
+  call writefile(lines, 'XtestSigncolumnNumber', 'D')
+  let buf = RunVimInTerminal('-S XtestSigncolumnNumber', {'rows': 5})
+  call VerifyScreenDump(buf, 'Test_sign_number_without_signtext', {})
+
+  call StopVimInTerminal(buf)
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index aa7f461..c84709e 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1378,
+/**/
     1377,
 /**/
     1376,