From 4280408dd1affe7860fdc9b1381a6ee98eb3d48c Mon Sep 17 00:00:00 2001
From: Rob Swindell <rob@synchro.net>
Date: Mon, 7 Mar 2022 20:32:00 -0800
Subject: [PATCH] Throw an error if trying to convert a > 1-bit BMP file to
 XBin

---
 exec/xbimage.js | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/exec/xbimage.js b/exec/xbimage.js
index b8d47ef872..349d60e6a7 100644
--- a/exec/xbimage.js
+++ b/exec/xbimage.js
@@ -1,5 +1,3 @@
-// $Id: xbimage.js,v 1.6 2020/04/19 19:52:31 rswindell Exp $
-
 // Utility module for creating and displaying XBin image files.
 
 load('sbbsdefs.js');
@@ -34,6 +32,11 @@ function convert_from_bmp(filename, charheight, fg_color, bg_color, palette, inv
 		return false;
 	}
 
+	if(bmp.infoheader.biBitCount != 1) {
+		alert(format("Bit-count (%d) must be 1 (monochrome)", bmp.infoheader.biBitCount));
+		return false;
+	}
+
 	// Add SAUCE 
 	var sauce = {
 		 title: title ? title : filename
-- 
GitLab