further fix to bug #2862, 'Segmentation fault when replying to a message where the...
[claws.git] / src / procmime.c
index 579674126150a91122b254c5f6d829734d882b3d..2fe223b9f3b531c9404be0b11ef502765b808b40 100644 (file)
@@ -798,17 +798,16 @@ gboolean procmime_scan_text_content(MimeInfo *mimeinfo,
        } else if (mimeinfo->type == MIMETYPE_TEXT) {
                while (SC_FGETS(buf, sizeof(buf), tmpfp) != NULL) {
                        str = conv_codeset_strdup(buf, src_codeset, CS_UTF_8);
        } else if (mimeinfo->type == MIMETYPE_TEXT) {
                while (SC_FGETS(buf, sizeof(buf), tmpfp) != NULL) {
                        str = conv_codeset_strdup(buf, src_codeset, CS_UTF_8);
+                       if (!str)
+                               str =  conv_codeset_strdup(buf, conv_get_locale_charset_str(), CS_UTF_8);
                        if (str) {
                        if (str) {
-                               if ((scan_ret = scan_callback(str, cb_data)) == TRUE) {
-                                       g_free(str);
-                                       break;
-                               }
-                               g_free(str);
-                       } else {
+                               if ((scan_ret = scan_callback(str, cb_data)) == TRUE) {
+                                       g_free(str);
+                                       break;
+                               }
+                               g_free(str);    
+                       } else
                                conv_fail = TRUE;
                                conv_fail = TRUE;
-                               if ((scan_ret = scan_callback(str, cb_data)) == TRUE)
-                                       break;
-                       }
                }
        }
 
                }
        }