From 5851230084e0d7a563aa90284c7412252d37bf19 Mon Sep 17 00:00:00 2001
From: Nikos Kouremenos <kourem@gmail.com>
Date: Sat, 23 Sep 2006 13:58:46 +0000
Subject: [PATCH] make sure we do not fail if path to iconset no longer exists.
 fixes #2444

---
 src/common/config.py |  4 +++-
 src/roster_window.py | 10 +++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/common/config.py b/src/common/config.py
index 8c3dff8eb3..c229c8b812 100644
--- a/src/common/config.py
+++ b/src/common/config.py
@@ -37,6 +37,8 @@ opt_bool = [ 'boolean', 0 ]
 opt_color = [ 'color', '^(#[0-9a-fA-F]{6})|()$' ]
 opt_one_window_types = ['never', 'always', 'peracct', 'pertype']
 
+DEFAULT_ICONSET = 'dcraven'
+
 class Config:
 
 	__options = {
@@ -67,7 +69,7 @@ class Config:
 		'last_status_msg_invisible': [ opt_str, '' ],
 		'last_status_msg_offline': [ opt_str, '' ],
 		'trayicon': [ opt_bool, True, '', True ],
-		'iconset': [ opt_str, 'dcraven', '', True ],
+		'iconset': [ opt_str, DEFAULT_ICONSET, '', True ],
 		'use_transports_iconsets': [ opt_bool, True, '', True ],
 		'inmsgcolor': [ opt_color, '#a34526', '', True ],
 		'outmsgcolor': [ opt_color, '#164e6f', '', True ],
diff --git a/src/roster_window.py b/src/roster_window.py
index 214aa380a2..9c343e6130 100644
--- a/src/roster_window.py
+++ b/src/roster_window.py
@@ -3129,9 +3129,13 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
 	def make_jabber_state_images(self):
 		'''initialise jabber_state_images dict'''
 		iconset = gajim.config.get('iconset')
-		if not iconset:
-			iconset = 'dcraven'
-		path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '32x32')
+		if iconset:
+			path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '32x32')
+			if not os.path.exists(path):
+				iconset = DEFAULT_ICONSET
+		else: 
+			iconset = DEFAULT_ICONSET
+
 		self.jabber_state_images['32'] = self.load_iconset(path)
 
 		path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '16x16')
-- 
GitLab