# HG changeset patch # User Darkvater # Date 1167997271 0 # Node ID 9336b14a5ef2b0f4077249700c3780c69f4894a9 # Parent 18b942cf112c5e35103c5946e9d00cc616229ac2 (svn r7861) -Fix (r7823): Crash when oldest news was deleted. First check the index for oldest news and THEN decrease index, not the other way around. diff -r 18b942cf112c -r 9336b14a5ef2 src/news_gui.c --- a/src/news_gui.c Fri Jan 05 07:36:33 2007 +0000 +++ b/src/news_gui.c Fri Jan 05 11:41:11 2007 +0000 @@ -912,17 +912,15 @@ w = FindWindowById(WC_NEWS_WINDOW, 0); visible_news = (w != NULL) ? (NewsID)(WP(w, news_d).ni - _news_items) : INVALID_NEWS; - i = n; - do { + for (i = n;; i = decreaseIndex(i)) { _news_items[i] = _news_items[decreaseIndex(i)]; if (i == _current_news) _current_news = increaseIndex(_current_news); if (i == _forced_news) _forced_news = increaseIndex(_forced_news); if (i == visible_news) WP(w, news_d).ni = &_news_items[increaseIndex(visible_news)]; - i = decreaseIndex(i); - } while (i != _oldest_news); - + if (i == _oldest_news) break; + } _oldest_news = increaseIndex(_oldest_news); }