diff options
-rw-r--r-- | pttbbs/mbbsd/board.c | 23 | ||||
-rw-r--r-- | pttbbs/mbbsd/fav.c | 1 |
2 files changed, 21 insertions, 3 deletions
diff --git a/pttbbs/mbbsd/board.c b/pttbbs/mbbsd/board.c index 6141089a..d3ed77d9 100644 --- a/pttbbs/mbbsd/board.c +++ b/pttbbs/mbbsd/board.c @@ -939,10 +939,19 @@ load_boards(char *key) } if (!IN_CLASS()) { if(IS_LISTING_FAV()){ - fav_t *fav = get_current_fav(); - int nfav = get_data_number(fav); + fav_t *fav = get_current_fav(); + int nfav; + // XXX TODO 很多人死在這裡,但我不確定他們是 fav 臨時壞掉還是該永久修正 // workaround 應該是 nfav = fav ? get_data_number(fav) : 0; + if (!get_current_fav()) { + vmsgf("我的最愛系統錯誤,請到" BN_BUGREPORT "報告您之前進行了哪些動作,謝謝"); + refresh(); + assert(get_current_fav()); + exit(-1); + } + + nfav = get_data_number(fav); if( nfav == 0 ) { nbrdsize = 1; nbrd = (boardstat_t *)malloc(sizeof(boardstat_t) * 1); @@ -1486,8 +1495,16 @@ choose_board(int newflag) char keyword[13] = "", buf[PATHLEN]; setutmpmode(newflag ? READNEW : READBRD); - if( get_fav_root() == NULL ) + if( get_fav_root() == NULL ) { fav_load(); + if (!get_current_fav()) { + vmsgf("我的最愛載入失敗,請到" BN_BUGREPORT "報告您之前進行了哪些動作,謝謝"); + refresh(); + assert(get_current_fav()); + exit(-1); + } + } + ++choose_board_depth; brdnum = 0; if (!cuser.userlevel) /* guest yank all boards */ diff --git a/pttbbs/mbbsd/fav.c b/pttbbs/mbbsd/fav.c index d6e54b07..5c1b94fd 100644 --- a/pttbbs/mbbsd/fav.c +++ b/pttbbs/mbbsd/fav.c @@ -521,6 +521,7 @@ int fav_load(void) fav_t *fp; if (fav_stack_num > 0) return -1; + setuserfile(buf, FAV); if (!dashf(buf)) { |