shithub: neatroff

Download patch

ref: 4845d662a2115ddae6e03fe550b5940f27d1e08f
parent: 9d080a66d8c2221b2c63788804d62187368d10f9
author: Ali Gholami Rudi <ali@rudi.ir>
date: Sat Dec 17 19:09:35 EST 2016

tr: handle invalid .bd arguments

--- a/tr.c
+++ b/tr.c
@@ -636,9 +636,11 @@
 
 static void tr_bd(char **args)
 {
+	struct font *fn = args[1] ? dev_font(dev_pos(args[1])) : NULL;
 	if (!args[1] || !strcmp("S", args[1]))
 		return;
-	font_setbd(dev_font(dev_pos(args[1])), args[2] ? eval(args[2], 'u') : 0);
+	if (fn)
+		font_setbd(fn, args[2] ? eval(args[2], 'u') : 0);
 }
 
 static void tr_it(char **args)