From: Vsevolod Stakhov Date: Mon, 13 Nov 2023 13:03:49 +0000 (+0000) Subject: [Fix] Set loaded variable explicitly X-Git-Tag: 3.8.0~73 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b6612604aa2b06ef7b12c2aaf24a4175dcea67e5;p=rspamd.git [Fix] Set loaded variable explicitly --- diff --git a/src/libmime/lang_detection_fasttext.cxx b/src/libmime/lang_detection_fasttext.cxx index a1490fc11..c973ed710 100644 --- a/src/libmime/lang_detection_fasttext.cxx +++ b/src/libmime/lang_detection_fasttext.cxx @@ -40,7 +40,7 @@ class fasttext_langdet { private: fasttext::FastText ft; std::string model_fname; - bool loaded; + bool loaded = false; public: explicit fasttext_langdet(struct rspamd_config *cfg) @@ -124,10 +124,11 @@ public: return predictions; } - auto model_info(void) const -> std::string + auto model_info(void) const -> const std::string { if (!loaded) { - return "fasttext model is not loaded"; + static const auto not_loaded = std::string{"fasttext model is not loaded"}; + return not_loaded; } else { return fmt::format("fasttext model {}: {} languages, {} tokens", model_fname,