From c9419843cc2efdd18f981d088e14e381f8a71837 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Fri, 3 Jul 2015 01:01:05 +0300 Subject: [PATCH] Don't allow setting invalid or unknown language --- fbreader/fbreader/fbreader/src/library/Book.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fbreader/fbreader/fbreader/src/library/Book.cpp b/fbreader/fbreader/fbreader/src/library/Book.cpp index 5ee7400..ea50519 100644 --- a/fbreader/fbreader/fbreader/src/library/Book.cpp +++ b/fbreader/fbreader/fbreader/src/library/Book.cpp @@ -238,13 +238,11 @@ void Book::setTitle(const std::string &title) { } void Book::setLanguage(const std::string &language) { - if (!myLanguage.empty()) { + if (!language.empty()) { const std::vector &codes = ZLLanguageList::languageCodes(); std::vector::const_iterator it = - std::find(codes.begin(), codes.end(), myLanguage); - std::vector::const_iterator jt = std::find(codes.begin(), codes.end(), language); - if (it != codes.end() && jt == codes.end()) { + if (it == codes.end()) { return; } }