Browse Source

Merge pull request #372 from nwoolls/bug/osx-segfault-narrowterm

Bugfix: segmentation fault if the terminal window is too narrow
Luke-Jr 12 years ago
parent
commit
41e92ed893
1 changed files with 5 additions and 0 deletions
  1. 5 0
      miner.c

+ 5 - 0
miner.c

@@ -3622,6 +3622,11 @@ void bfg_wspctoeol(WINDOW * const win, const int offset)
 	getmaxyx(win, y, maxx);
 	getyx(win, y, x);
 	const int space_count = (maxx - x) - offset;
+	
+	// Check for negative - terminal too narrow
+	if (space_count <= 0)
+		return;
+	
 	char buf[space_count];
 	memset(buf, ' ', space_count);
 	waddnstr(win, buf, space_count);