summaryrefslogtreecommitdiff
path: root/news_gui.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-03-04 17:18:13 +0000
committertron <tron@openttd.org>2006-03-04 17:18:13 +0000
commit6394725ae84dd4d60626472104ef8bb8f352f4b3 (patch)
treeef374db717e010cf07dc0523723ec0386d42c380 /news_gui.c
parent8d3e42fe3c638af7206e4be1735bf853b55bee9f (diff)
downloadopenttd-6394725ae84dd4d60626472104ef8bb8f352f4b3.tar.xz
(svn r3761) Fix two bugs in r3757
Diffstat (limited to 'news_gui.c')
-rw-r--r--news_gui.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/news_gui.c b/news_gui.c
index 4bbfe3e1b..941307daf 100644
--- a/news_gui.c
+++ b/news_gui.c
@@ -861,7 +861,7 @@ void DeleteVehicleNews(VehicleID vid, StringID news)
{
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 @@ void DeleteVehicleNews(VehicleID vid, StringID news)
_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;
+ }
}
}
}