From bf5208dd3df18e7ff05c4e18b3f03c00baf22238 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 28 Feb 2016 15:04:11 +0100 Subject: GUI: Fix two leaks in predictive dialog --- gui/predictivedialog.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'gui/predictivedialog.cpp') diff --git a/gui/predictivedialog.cpp b/gui/predictivedialog.cpp index 6ff10267db..d9dd5734f8 100644 --- a/gui/predictivedialog.cpp +++ b/gui/predictivedialog.cpp @@ -981,6 +981,7 @@ void PredictiveDialog::loadAllDictionary(Dict &dict) { Common::File *inFile = new Common::File(); if (!inFile->open(ConfMan.get(dict.nameDict))) { warning("Predictive Dialog: cannot read file: %s", dict.defaultFilename.c_str()); + delete inFile; return; } loadDictionary(inFile, dict); -- cgit v1.2.3 From aded46f08b476ee1caccc070b8495cafe7094b47 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sun, 28 Feb 2016 15:23:24 +0100 Subject: GUI: Don't crash on empty dictionary in predictive dialog --- gui/predictivedialog.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gui/predictivedialog.cpp') diff --git a/gui/predictivedialog.cpp b/gui/predictivedialog.cpp index d9dd5734f8..9557da1206 100644 --- a/gui/predictivedialog.cpp +++ b/gui/predictivedialog.cpp @@ -724,6 +724,10 @@ int PredictiveDialog::binarySearch(const char *const *const dictLine, const Comm } bool PredictiveDialog::matchWord() { + // If there is no dictionary, then there is no match. + if (_unitedDict.dictLineCount <= 0) + return false; + // If no text has been entered, then there is no match. if (_currentCode.empty()) return false; -- cgit v1.2.3