From 99308c2be2f6c1bff74706c006d07e3c137ba8d8 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Thu, 26 Nov 2015 12:38:53 -0500 Subject: ???? --- malaprop.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'malaprop.cpp') diff --git a/malaprop.cpp b/malaprop.cpp index 7fbdb6c..c308d34 100644 --- a/malaprop.cpp +++ b/malaprop.cpp @@ -117,6 +117,12 @@ std::string malaprop::alternate(std::string word) { soundex ex = soundify(word); std::set& opts = dict[ex]; + if (opts.size() == 0) + { + // Not sure why this can even happen but it is happenining???? + return word; + } + int opt = rand() % opts.size(); for (std::set::iterator it = opts.begin(); it != opts.end(); it++) { -- cgit 1.4.1