summaryrefslogtreecommitdiff
path: root/plugins/UserInfoEx/src/classMAnnivDate.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-01-29 19:33:13 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-01-29 19:33:13 +0300
commitf627783781218a38e066a010654bbfce28775b35 (patch)
tree0a5201bdddb7b61ddb7c9768e394125b118981b1 /plugins/UserInfoEx/src/classMAnnivDate.cpp
parent8ac32fb44ce4218555fe51e5afc75bd870319575 (diff)
UInfoEx: average age calculation fix
Diffstat (limited to 'plugins/UserInfoEx/src/classMAnnivDate.cpp')
-rw-r--r--plugins/UserInfoEx/src/classMAnnivDate.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/plugins/UserInfoEx/src/classMAnnivDate.cpp b/plugins/UserInfoEx/src/classMAnnivDate.cpp
index be8f50995f..462b7ee500 100644
--- a/plugins/UserInfoEx/src/classMAnnivDate.cpp
+++ b/plugins/UserInfoEx/src/classMAnnivDate.cpp
@@ -345,14 +345,16 @@ int MAnnivDate::DBGetDate(MCONTACT hContact, LPCSTR pszModule, LPCSTR szDay, LPC
{
ZeroDate();
- uint16_t wtmp = db_get_w(hContact, pszModule, szYear, 0);
+ int wtmp = db_get_w(hContact, pszModule, szYear);
+ if (wtmp <= 1900)
+ wtmp = 0;
Year(wtmp);
- wtmp = db_get_w(hContact, pszModule, szMonth, 0);
+ wtmp = db_get_w(hContact, pszModule, szMonth);
if (wtmp > 0 && wtmp < 13) {
Month(wtmp);
- wtmp = db_get_w(hContact, pszModule, szDay, 0);
+ wtmp = db_get_w(hContact, pszModule, szDay);
if (wtmp > 0 && wtmp <= DaysInMonth(Month())) {
Day(wtmp);
// date was correctly read from db