summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/Clist_modern/src/modern_clisttray.cpp21
-rw-r--r--src/mir_core/src/subclass.cpp3
2 files changed, 14 insertions, 10 deletions
diff --git a/plugins/Clist_modern/src/modern_clisttray.cpp b/plugins/Clist_modern/src/modern_clisttray.cpp
index 9f9f9a40af..14ce0aa1d1 100644
--- a/plugins/Clist_modern/src/modern_clisttray.cpp
+++ b/plugins/Clist_modern/src/modern_clisttray.cpp
@@ -411,7 +411,6 @@ int cliTrayCalcChanged(const char *szChangedProto, int, int)
HICON hIcon = NULL;
int i = 0, iStatus;
- char *szProto;
switch (Mode) {
case TRAY_ICON_MODE_GLOBAL:
@@ -421,17 +420,19 @@ int cliTrayCalcChanged(const char *szChangedProto, int, int)
case TRAY_ICON_MODE_ACC:
// В этом режиме показывается иконка совершенно определённого аккаунта, и не всегда это szChangedProto.
- szProto = db_get_sa(NULL, "CList", bDiffers ? "tiAccV" : "tiAccS");
- if (szProto == NULL)
- break;
+ {
+ ptrA szProto(db_get_sa(0, "CList", bDiffers ? "tiAccV" : "tiAccS"));
+ if (szProto == nullptr)
+ break;
- iStatus = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
- if (g_StatusBarData.bConnectingIcon && IsStatusConnecting(iStatus))
- hIcon = (HICON)CLUI_GetConnectingIconService((WPARAM)szProto, 0);
- else
- hIcon = pcli->pfnGetIconFromStatusMode(NULL, szProto, CallProtoService(szProto, PS_GETSTATUS, 0, 0));
+ iStatus = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
+ if (g_StatusBarData.bConnectingIcon && IsStatusConnecting(iStatus))
+ hIcon = (HICON)CLUI_GetConnectingIconService((WPARAM)szProto, 0);
+ else
+ hIcon = pcli->pfnGetIconFromStatusMode(NULL, szProto, CallProtoService(szProto, PS_GETSTATUS, 0, 0));
- pcli->pfnTrayIconMakeTooltip(NULL, szProto);
+ pcli->pfnTrayIconMakeTooltip(NULL, szProto);
+ }
break;
case TRAY_ICON_MODE_CYCLE:
diff --git a/src/mir_core/src/subclass.cpp b/src/mir_core/src/subclass.cpp
index f917646bb7..9188ad60aa 100644
--- a/src/mir_core/src/subclass.cpp
+++ b/src/mir_core/src/subclass.cpp
@@ -58,6 +58,9 @@ static LRESULT CALLBACK MSubclassWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LP
MIR_CORE_DLL(void) mir_subclassWindow(HWND hWnd, WNDPROC wndProc)
{
+ if (hWnd == nullptr)
+ return;
+
MSubclassData *p = arSubclass.find((MSubclassData*)&hWnd);
if (p == NULL) {
p = new MSubclassData;