From 703a244b9b8c1b4af02a6132c5c70a748d98e3f8 Mon Sep 17 00:00:00 2001
From: J-P Nurmi <jpnurmi@gmail.com>
Date: Tue, 28 Apr 2015 10:00:55 +0200
Subject: [PATCH] Fix #954: Startup failure when simple_away is loaded
 after awaynick

---
 src/User.cpp | 5 +++++
 1 file changed, 5 insertions(+)

--- a/src/User.cpp
+++ b/src/User.cpp
@@ -1101,6 +1101,11 @@ bool CUser::LoadModule(const CString& sM
 		CFile fNVFile = CFile(GetUserPath() + "/moddata/" + sModName + "/.registry");
 
 		for (vector<CIRCNetwork*>::iterator it = m_vIRCNetworks.begin(); it != m_vIRCNetworks.end(); ++it) {
+			// Check whether the network already has this module loaded (#954)
+			if ((*it)->GetModules().FindModule(sModName)) {
+				continue;
+			}
+
 			if (fNVFile.Exists()) {
 				CString sNetworkModPath = (*it)->GetNetworkPath() + "/moddata/" + sModName;
 				if (!CFile::Exists(sNetworkModPath)) {
