From ba8c5e618e1b2cee24554abf3d51118019aa4c0e Mon Sep 17 00:00:00 2001 From: scw Date: Mon, 29 Aug 2005 15:17:08 +0000 Subject: prevent from search_ulist_userid() returning NULL git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3116 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/chess.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mbbsd/chess.c b/mbbsd/chess.c index ebe25e16..e9eca609 100644 --- a/mbbsd/chess.c +++ b/mbbsd/chess.c @@ -1151,8 +1151,13 @@ ChessInitUser(ChessInfo* info) case CHESS_MODE_WATCH: uinfo = search_ulist_userid(currutmp->mateid); - strlcpy(userid[0], uinfo->userid, sizeof(userid[0])); - strlcpy(userid[1], uinfo->mateid, sizeof(userid[1])); + if (uinfo) { + strlcpy(userid[0], uinfo->userid, sizeof(userid[0])); + strlcpy(userid[1], uinfo->mateid, sizeof(userid[1])); + } else { + strlcpy(userid[0], currutmp->userid, sizeof(userid[0])); + userid[1][0] = 0; + } break; case CHESS_MODE_VERSUS: -- cgit v1.2.3