diff options
author | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-08-28 01:51:39 +0800 |
---|---|---|
committer | kcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-08-28 01:51:39 +0800 |
commit | c2892cc68ad42ef2c859696e3a17ffdb05a23adc (patch) | |
tree | 542a7307880463fc558be15d7597d81c0a48096c /mbbsd | |
parent | 3a43cae8a1628509052dbfaaef9b09ff700fd49d (diff) | |
download | pttbbs-c2892cc68ad42ef2c859696e3a17ffdb05a23adc.tar pttbbs-c2892cc68ad42ef2c859696e3a17ffdb05a23adc.tar.gz pttbbs-c2892cc68ad42ef2c859696e3a17ffdb05a23adc.tar.bz2 pttbbs-c2892cc68ad42ef2c859696e3a17ffdb05a23adc.tar.lz pttbbs-c2892cc68ad42ef2c859696e3a17ffdb05a23adc.tar.xz pttbbs-c2892cc68ad42ef2c859696e3a17ffdb05a23adc.tar.zst pttbbs-c2892cc68ad42ef2c859696e3a17ffdb05a23adc.zip |
skip invalid entry when fav_free.
comment bad code, insert fav in empty folder.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3091 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/board.c | 1 | ||||
-rw-r--r-- | mbbsd/fav.c | 8 |
2 files changed, 7 insertions, 2 deletions
diff --git a/mbbsd/board.c b/mbbsd/board.c index f98da23d..1355ad34 100644 --- a/mbbsd/board.c +++ b/mbbsd/board.c @@ -1151,6 +1151,7 @@ choose_board(int newflag) else { ptr->attr |= NBRD_FAV; + // FIXME 在空的 folder 'i' 是錯的 if (ch == 'i') move_in_current_folder(brdnum, num); else diff --git a/mbbsd/fav.c b/mbbsd/fav.c index 84951c14..0bd93633 100644 --- a/mbbsd/fav.c +++ b/mbbsd/fav.c @@ -315,7 +315,7 @@ static void rebuild_fav(fav_t *fp, int clean_invisible) fp->DataTail = 0; for (i = 0, j = 0; i < nData; i++){ - if (!(fp->favh[i].attr & FAVH_FAV)) + if (!valid_item(&fp->favh[i])) continue; ft = &fp->favh[i]; @@ -629,6 +629,8 @@ static void fav_free_branch(fav_t *fp) if (fp == NULL) return; for(i = 0; i < fp->DataTail; i++){ + if (!valid_item(ft)) + continue; ft = &fp->favh[i]; switch(get_item_type(ft)){ case FAVT_FOLDER: @@ -804,6 +806,8 @@ static void move_in_folder(fav_t *fav, int src, int dst) if (src == dst || fav == NULL) return; + assert(src < fav->DataTail); + assert(dst < fav->DataTail); dirty = 1; @@ -956,7 +960,7 @@ static void fav_dosomething_tagged_item(fav_t *fp, int (*act)(fav_t *, fav_type_ { int i; for(i = 0; i < fp->DataTail; i++){ - if (is_set_attr(&fp->favh[i], FAVH_FAV) && is_set_attr(&fp->favh[i], FAVH_TAG)) + if (valid_item(&fp->favh[i]) && is_set_attr(&fp->favh[i], FAVH_TAG)) if ((*act)(fp, &fp->favh[i]) < 0) break; } |