shithub: riscv

Download patch

ref: 0596178dd660daaeedeb7eaaea5c0cf27fb49d41
parent: 0e632454e2d6cba7acb7e05771e027244e02416d
author: cinap_lenrek <[email protected]>
date: Sun Dec 27 18:39:28 EST 2020

kbmap: avoid division by zero when window becomes too small

--- a/sys/src/cmd/kbmap.c
+++ b/sys/src/cmd/kbmap.c
@@ -103,6 +103,8 @@
 	Rectangle r;
 
 	rows = (Dy(screen->r)-2*MARGIN+PAD)/(font->height+PAD);
+	if(rows < 1)
+		rows = 1;
 
 	r = Rect(0,0,(Dx(screen->r)-2*MARGIN), font->height);
 	for(i=0; i<nmap; i++)