From 7991dffa2000471d97a3a03d692a76d47cc88d24 Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Wed, 27 Sep 2006 04:53:27 +0000
Subject: [PATCH] Prevent NULL dereference.

---
 src/syncterm/bbslist.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/syncterm/bbslist.c b/src/syncterm/bbslist.c
index 944f7c01f1..00a3984a20 100644
--- a/src/syncterm/bbslist.c
+++ b/src/syncterm/bbslist.c
@@ -734,14 +734,16 @@ struct bbslist *show_bbslist(int mode)
 							at_settings=!at_settings;
 							break;
 						case -7:		/* CTRL-E */
-							i=list[opt]->id;
-							if(edit_list(list[opt],listpath,FALSE)) {
-								sort_list(list);
-								for(j=0;list[j]!=NULL && list[j]->name[0];j++) {
-									if(list[j]->id==i)
-										opt=j;
+							if(list[opt]) {
+								i=list[opt]->id;
+								if(edit_list(list[opt],listpath,FALSE)) {
+									sort_list(list);
+									for(j=0;list[j]!=NULL && list[j]->name[0];j++) {
+										if(list[j]->id==i)
+											opt=j;
+									}
+									oldopt=-1;
 								}
-								oldopt=-1;
 							}
 							break;
 						case -6:		/* CTRL-D */
-- 
GitLab