From bc527b1e07f18ecab6badda0a96db529c3472043 Mon Sep 17 00:00:00 2001 From: pescuma Date: Wed, 4 Jun 2008 03:12:03 +0000 Subject: Fix for crash git-svn-id: http://pescuma.googlecode.com/svn/trunk/Miranda@110 c086bb3d-8645-0410-b8da-73a8550f86e7 --- Plugins/emoticons/emoticons.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'Plugins/emoticons/emoticons.cpp') diff --git a/Plugins/emoticons/emoticons.cpp b/Plugins/emoticons/emoticons.cpp index 09d2ba0..633454e 100644 --- a/Plugins/emoticons/emoticons.cpp +++ b/Plugins/emoticons/emoticons.cpp @@ -30,7 +30,7 @@ PLUGININFOEX pluginInfo={ #else "Emoticons", #endif - PLUGIN_MAKE_VERSION(0,0,2,7), + PLUGIN_MAKE_VERSION(0,0,2,9), "Emoticons", "Ricardo Pescuma Domenecci", "", @@ -2198,6 +2198,9 @@ EmoticonPack *GetPack(char *name) Module *GetModuleByName(const char *name) { + if (name == NULL) + return NULL; + Module *ret = NULL; for(int i = 0; i < modules.getCount(); i++) { @@ -3591,7 +3594,7 @@ int ParseService(SMADD_PARSE *sp, BOOL unicode) Module *module = GetModule(sp->Protocolname); - if (start >= len || start < 0) + if (start >= len || start < 0 || module == NULL) return -1; EmoticonFound found; @@ -3646,6 +3649,12 @@ int BatchParseService(WPARAM wParam, LPARAM lParam) if (bp == NULL || bp->cbSize < sizeof(SMADD_BATCHPARSE2) || bp->str == NULL) return NULL; + Contact *contact = GetContact(bp->hContact); + Module *module = GetContactModule(bp->hContact, bp->Protocolname); + + if (module == NULL) + return NULL; + Buffer ret; BOOL path = (bp->flag & SAFL_PATH); @@ -3658,9 +3667,6 @@ int BatchParseService(WPARAM wParam, LPARAM lParam) text = mir_a2t(bp->astr); int len = lstrlen(text); - Contact *contact = GetContact(bp->hContact); - Module *module = GetContactModule(bp->hContact, bp->Protocolname); - EmoticonFound found; int count = 0; for(int i = 0; i < len; i++) -- cgit v1.2.3