From b656e19ff168e27583a33c268874345ffcea6d4d Mon Sep 17 00:00:00 2001
From: "Rob Swindell (on Windows 11)" <rob@synchro.net>
Date: Thu, 10 Oct 2024 22:18:49 -0700
Subject: [PATCH] Report error when menu() can't find a display file and
 P_NOERROR not used

This issue was introduced in commit d02fc1a2 (3 years ago), where menu() would
silenty fail (just return false) if no display file matching the supported
menu/display file types/extensions could be found.

Previous to commit d02fc1a2, we would log a NOTICE-level message and display
a "File not found" message to the user (what sbbs_t::printfile() does), but
since d02fc1a2, we no longer even call printfile() when the file doesn't
exist, so no error was logged or message displayed to the user.

Of course, when using the P_NOERROR mode flag, silent failure is expected and
that's still what happens in that case.
---
 src/sbbs3/prntfile.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/sbbs3/prntfile.cpp b/src/sbbs3/prntfile.cpp
index 4f94366d36..187f8d5db7 100644
--- a/src/sbbs3/prntfile.cpp
+++ b/src/sbbs3/prntfile.cpp
@@ -282,8 +282,11 @@ bool sbbs_t::menu(const char *code, int mode, JSObject* obj)
 			}
 			if(menu_exists(code, next, path))
 				break;
-			if(!menu_exists(code, last, path))
+			if(!menu_exists(code, last, path)) {
+				if(!(mode & P_NOERROR))
+					errormsg(WHERE, ERR_CHK, path);
 				return false;
+			}
 		} while(0);
 	}
 
-- 
GitLab