summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/extra/stats/m_chanstats.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/extra/stats/m_chanstats.cpp b/modules/extra/stats/m_chanstats.cpp
index 13958dcc3..c3be9d640 100644
--- a/modules/extra/stats/m_chanstats.cpp
+++ b/modules/extra/stats/m_chanstats.cpp
@@ -589,7 +589,12 @@ class MChanstats : public Module
size_t smileys_other = CountSmileys(msg, SmileysOther);
// do not count smileys as words
- words = words - smileys_happy - smileys_sad - smileys_other;
+ size_t smileys = smileys_happy + smileys_sad + smileys_other;
+ if (smileys > words)
+ words = 0;
+ else
+ words = words - smileys;
+
query = "CALL " + prefix + "chanstats_proc_update(@channel@, @nick@, 1, @letters@, @words@, @action@, "
"@smileys_happy@, @smileys_sad@, @smileys_other@, '0', '0', '0', '0');";
query.SetValue("channel", c->name);