# Calculate format=diff
diff --git a/src/message_window.py b/src/message_window.py
index 7fd6b44..86968bc 100644
--- a/src/message_window.py
+++ b/src/message_window.py
@@ -1227,16 +1227,17 @@ class MessageWindowMgr(gobject.GObject):
                 gajim.config.set_per('accounts', acct, pos_y_key, y)
 
         else:
-            win_maximized = msg_win.window.window.get_state() == \
-                    gtk.gdk.WINDOW_STATE_MAXIMIZED
-            gajim.config.set(max_win_key, win_maximized)
-            width += width_adjust
-            gajim.config.set(size_width_key, width)
-            gajim.config.set(size_height_key, height)
-
-            if self.mode != self.ONE_MSG_WINDOW_NEVER:
-                gajim.config.set(pos_x_key, x)
-                gajim.config.set(pos_y_key, y)
+            if msg_win.window.window:
+                win_maximized = msg_win.window.window.get_state() == \
+                        gtk.gdk.WINDOW_STATE_MAXIMIZED
+                gajim.config.set(max_win_key, win_maximized)
+                width += width_adjust
+                gajim.config.set(size_width_key, width)
+                gajim.config.set(size_height_key, height)
+
+                if self.mode != self.ONE_MSG_WINDOW_NEVER:
+                    gajim.config.set(pos_x_key, x)
+                    gajim.config.set(pos_y_key, y)
 
     def reconfig(self):
         for w in self.windows():
