From 5c9d5199f8139aa85203343efad54be4e80a6132 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Wed, 22 Nov 2006 18:25:16 +0000 Subject: Don't crash in loadDict() if pred.txt is missing. svn-id: r24761 --- engines/agi/predictive.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'engines/agi') diff --git a/engines/agi/predictive.cpp b/engines/agi/predictive.cpp index 2de626d1f4..6fed021fb3 100644 --- a/engines/agi/predictive.cpp +++ b/engines/agi/predictive.cpp @@ -63,8 +63,11 @@ bool TextMan::predictiveDialog(void) { }; const char *modes[] = { "Pre", "123", "Abc" }; - if (!_dict.size()) + if (!_dict.size()) { loadDict(); + if (!_dict.size()) + return false; + } draw_window(50, 40, 269, 159); draw_rectangle(62, 54, 249, 66, MSG_BOX_TEXT); @@ -267,7 +270,8 @@ void TextMan::loadDict(void) { Common::File in; char buf[MAXLINELEN]; - in.open("pred.txt"); + if (!in.open("pred.txt")) + return; while (!in.eos()) { if (!in.readLine(buf, MAXLINELEN)) -- cgit v1.2.3