From b1c5b63de2d35785575e5209da70deaf73ca42bc Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Thu, 15 Feb 2018 23:44:07 +0000
Subject: [PATCH] If msgbase.get_msg_body() returns null (error getting message
 body), return an NNTP error. I'm not sure if this has anything to do with
 Nelgin's reported problem, but possibly.

---
 exec/nntpservice.js | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/exec/nntpservice.js b/exec/nntpservice.js
index b3e16f96b9..dc18e0296f 100644
--- a/exec/nntpservice.js
+++ b/exec/nntpservice.js
@@ -604,19 +604,25 @@ while(client.socket.is_connected && !quit) {
 
 			current_article=hdr.number;
 
-			if(cmd[0].toUpperCase()!="HEAD")
+			if(cmd[0].toUpperCase()!="HEAD") {
 				body=msgbase.get_msg_body(false,current_article
 					,true /* remove ctrl-a codes */
 					,true /* rfc822 formatted text */);
 
-			// force taglines for QNET Users on local messages
-			if(add_tag && user.security.restrictions&UFLAG_Q && !hdr.from_net_type)
-				body += "\r\n" + tearline + tagline;
+				if(!body) {
+					writeln("430 error getting message body: " + msgbase.last_error);
+					break;
+				}
 
-			if(!ex_ascii || (msgbase.cfg && msgbase.cfg.settings&SUB_ASCII)) {
-				/* Convert Ex-ASCII chars to approximate ASCII equivalents */
-				body = ascii_str(body);
-				hdr.subject = ascii_str(hdr.subject);
+				// force taglines for QNET Users on local messages
+				if(add_tag && user.security.restrictions&UFLAG_Q && !hdr.from_net_type)
+					body += "\r\n" + tearline + tagline;
+
+				if(!ex_ascii || (msgbase.cfg && msgbase.cfg.settings&SUB_ASCII)) {
+					/* Convert Ex-ASCII chars to approximate ASCII equivalents */
+					body = ascii_str(body);
+					hdr.subject = ascii_str(hdr.subject);
+				}
 			}
 
 /* Eliminate dupe loops
-- 
GitLab