From 13b4f3fe75c3aa450125fe895b42f3b3154fff11 Mon Sep 17 00:00:00 2001 From: scw Date: Mon, 29 Mar 2004 01:01:58 +0000 Subject: Fix bad assertion when deleting tagged mail in mailbox. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1622 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/mail.c | 4 ++++ mbbsd/read.c | 13 ++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/mbbsd/mail.c b/mbbsd/mail.c index 506de43a..85f4c142 100644 --- a/mbbsd/mail.c +++ b/mbbsd/mail.c @@ -1445,10 +1445,14 @@ static onekey_t mail_comms[] = { int m_read() { + int back_bid; if (get_num_records(currmaildir, sizeof(fileheader_t))) { curredit = EDIT_MAIL; curredit &= ~EDIT_ITEM; + back_bid = currbid; + currbid = 0; i_read(RMAIL, currmaildir, mailtitle, maildoent, mail_comms, -1); + currbid = back_bid; curredit = 0; currutmp->mailalert = load_mailalert(cuser.userid); return 0; diff --git a/mbbsd/read.c b/mbbsd/read.c index eaff5ed8..8074c71b 100644 --- a/mbbsd/read.c +++ b/mbbsd/read.c @@ -162,16 +162,19 @@ int TagPruner(int bid) { boardheader_t *bp; - assert(bid>0); - bp = getbcache(bid); - if (strcmp(bp->brdname, "Security") == 0) - return DONOTHING; + assert(bid >= 0); /* bid == 0 means in mailbox */ + if (bid){ + bp = getbcache(bid); + if (strcmp(bp->brdname, "Security") == 0) + return DONOTHING; + } if (TagNum && ((currstat != READING) || (currmode & MODE_BOARD))) { if (tolower(getans("刪除所有標記[N]?")) != 'y') return FULLUPDATE; delete_range(currdirect, 0, 0); TagNum = 0; - setbtotal(bid); + if (bid) + setbtotal(bid); return NEWDIRECT; } return DONOTHING; -- cgit v1.2.3