diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2023-11-13 13:03:49 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2023-11-13 13:03:49 +0000 |
commit | b6612604aa2b06ef7b12c2aaf24a4175dcea67e5 (patch) | |
tree | 7db37bb67bfcaf1129317957f82b35f4176302c2 /src/libmime | |
parent | 0be20c43fad8ebe466e69496d8217658e3814426 (diff) | |
download | rspamd-b6612604aa2b06ef7b12c2aaf24a4175dcea67e5.tar.gz rspamd-b6612604aa2b06ef7b12c2aaf24a4175dcea67e5.zip |
[Fix] Set loaded variable explicitly
Diffstat (limited to 'src/libmime')
-rw-r--r-- | src/libmime/lang_detection_fasttext.cxx | 7 |
1 files changed, 4 insertions, 3 deletions
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, |