(svn r3761) Fix two bugs in r3757
authortron
Sat, 04 Mar 2006 17:18:13 +0000
changeset 3143 30fa7ff401f8
parent 3142 00b67636048f
child 3144 426b825578f9
(svn r3761) Fix two bugs in r3757
news_gui.c
--- a/news_gui.c	Sat Mar 04 13:52:52 2006 +0000
+++ b/news_gui.c	Sat Mar 04 17:18:13 2006 +0000
@@ -861,7 +861,7 @@
 {
 	byte n;
 
-	for (n = _oldest_news; _latest_news != INVALID_NEWS && n != _latest_news + 1; n = (n + 1) % MAX_NEWS) {
+	for (n = _oldest_news; _latest_news != INVALID_NEWS && n != (_latest_news + 1) % MAX_NEWS; n = (n + 1) % MAX_NEWS) {
 		const NewsItem* ni = &_news_items[n];
 
 		if (ni->flags & NF_VEHICLE &&
@@ -883,9 +883,10 @@
 			_total_news--;
 
 			w = FindWindowById(WC_MESSAGE_HISTORY, 0);
-			if (w == NULL) return;
-			SetWindowDirty(w);
-			w->vscroll.count = _total_news;
+			if (w != NULL) {
+				SetWindowDirty(w);
+				w->vscroll.count = _total_news;
+			}
 		}
 	}
 }