diff options
-rw-r--r-- | mbbsd/board.c | 3 | ||||
-rw-r--r-- | mbbsd/fav.c | 6 |
2 files changed, 5 insertions, 4 deletions
diff --git a/mbbsd/board.c b/mbbsd/board.c index fc965804..f9331bc2 100644 --- a/mbbsd/board.c +++ b/mbbsd/board.c @@ -1151,8 +1151,7 @@ choose_board(int newflag) else { ptr->attr |= NBRD_FAV; - // FIXME 在空的 folder 'i' 是錯的 - if (ch == 'i') + if (ch == 'i' && get_data_number(get_current_fav()) > 1) move_in_current_folder(brdnum, num); else num = brdnum; diff --git a/mbbsd/fav.c b/mbbsd/fav.c index 35c3f417..56b3b8c3 100644 --- a/mbbsd/fav.c +++ b/mbbsd/fav.c @@ -809,13 +809,15 @@ static void move_in_folder(fav_t *fav, int src, int dst) dirty = 1; /* Find real locations of src and dst in fav->favh[] */ - for(count = i = 0; count <= src; i++) + for(count = i = 0; count <= src && i < fav->DataTail; i++) if (valid_item(&fav->favh[i])) count++; + if (count != src + 1) return; src = i - 1; - for(count = i = 0; count <= dst; i++) + for(count = i = 0; count <= dst && i < fav->DataTail; i++) if (valid_item(&fav->favh[i])) count++; + if (count != dst + 1) return; dst = i - 1; fav_item_copy(&tmp, &fav->favh[src]); |