- attachments = modest_msg_view_window_get_attachments (MODEST_MSG_VIEW_WINDOW(win));
- n_selected = g_list_length (attachments);
- g_list_free (attachments);
+
+ /* TODO: This check is here to prevent a gwarning, but this looks like a logic error.
+ * murrayc */
+ if (MODEST_IS_MSG_VIEW_WINDOW (win)) {
+ attachments = modest_msg_view_window_get_attachments (MODEST_MSG_VIEW_WINDOW(win));
+ n_selected = g_list_length (attachments);
+ g_list_free (attachments);
+ }