From b627e6177f20b7369a9d73829e7a846b21dcb939 Mon Sep 17 00:00:00 2001 From: HanzZ Date: Sun, 11 Mar 2012 11:31:02 +0100 Subject: [PATCH] Fixed crash in skype handleMemoryUsage --- backends/skype/main.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/backends/skype/main.cpp b/backends/skype/main.cpp index e8a56baf..0e849f4c 100644 --- a/backends/skype/main.cpp +++ b/backends/skype/main.cpp @@ -129,7 +129,9 @@ class SpectrumNetworkPlugin : public NetworkPlugin { void handleLoginRequest(const std::string &user, const std::string &legacyName, const std::string &password) { std::string name = legacyName; - name = name.substr(name.find(".") + 1); + if (name.find("skype.") == 0 || name.find("prpl-skype.") == 0) { + name = name.substr(name.find(".") + 1); + } LOG4CXX_INFO(logger, "Creating account with name '" << name << "'"); Skype *skype = new Skype(user, name, password); @@ -144,11 +146,13 @@ class SpectrumNetworkPlugin : public NetworkPlugin { shared = 0; for(std::map::const_iterator it = m_sessions.begin(); it != m_sessions.end(); it++) { Skype *skype = it->second; - double r; - double s; - process_mem_usage(s, r, skype->getPid()); - res += r; - shared += s; + if (skype) { + double r; + double s; + process_mem_usage(s, r, skype->getPid()); + res += r; + shared += s; + } } }