mirror of https://github.com/OpenTTD/OpenTTD
(svn r25093) -Fix [FS#5486]: Clicking the statusbar crashed, when news were pending but no news were shown yet. (3298)
parent
c2c50b0c50
commit
b09743f3e8
|
@ -909,8 +909,14 @@ void ShowLastNewsMessage()
|
||||||
} else if (_forced_news == NULL) {
|
} else if (_forced_news == NULL) {
|
||||||
/* Not forced any news yet, show the current one, unless a news window is
|
/* Not forced any news yet, show the current one, unless a news window is
|
||||||
* open (which can only be the current one), then show the previous item */
|
* open (which can only be the current one), then show the previous item */
|
||||||
const Window *w = FindWindowById(WC_NEWS_WINDOW, 0);
|
if (_current_news == NULL) {
|
||||||
ni = (w == NULL || (_current_news == _oldest_news)) ? _current_news : _current_news->prev;
|
/* No news were shown yet resp. the last shown one was already deleted.
|
||||||
|
* Threat this as if _forced_news reached _oldest_news; so, wrap around and start anew with the latest. */
|
||||||
|
ni = _latest_news;
|
||||||
|
} else {
|
||||||
|
const Window *w = FindWindowById(WC_NEWS_WINDOW, 0);
|
||||||
|
ni = (w == NULL || (_current_news == _oldest_news)) ? _current_news : _current_news->prev;
|
||||||
|
}
|
||||||
} else if (_forced_news == _oldest_news) {
|
} else if (_forced_news == _oldest_news) {
|
||||||
/* We have reached the oldest news, start anew with the latest */
|
/* We have reached the oldest news, start anew with the latest */
|
||||||
ni = _latest_news;
|
ni = _latest_news;
|
||||||
|
|
Loading…
Reference in New Issue