From 7ac02f0555ec1f6cf59c9bdc5fab42e90250e1b7 Mon Sep 17 00:00:00 2001 From: piaip Date: Fri, 6 Apr 2012 01:44:37 +0000 Subject: Fix segv: #1FVS--wT (PttBug) [ptt2.cc] git-svn-id: http://opensvn.csie.org/pttbbs/trunk@5598 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- pttbbs/mbbsd/friend.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pttbbs/mbbsd/friend.c b/pttbbs/mbbsd/friend.c index 5b7992b2..8cf2eca2 100644 --- a/pttbbs/mbbsd/friend.c +++ b/pttbbs/mbbsd/friend.c @@ -139,6 +139,8 @@ friend_append(int type, int count) move(2, 0); clrtobot(); outs("要引入哪一個名單?\n"); + + // TODO make the selection algorithm better here. for (j = i = 0; i < 4; i++) if (i != type) { ++j; @@ -178,6 +180,8 @@ friend_append(int type, int count) if (j == FRIEND_SPECIAL) friend_special(); + if (!friend_file[j]) + return; setfriendfile(sfile, j); if ((fp = fopen(sfile, "r")) != NULL) { -- cgit v1.2.3