-                        // fetch the next line.
-
-                        // pc currently points to nowhere, but after the next
-                        // pc++ in the for line it will point to the beginning
-                        // of the next line in the file
-                        pc = file[++nLine].c_str() - 1;
+                        // fetch the next line if there is one
+                        if ( nLine == nLineCount - 1 ) {
+                            // something is wrong, bail out
+                            cont = FALSE;
+
+                            wxLogDebug(wxT("Mailcap file %s, line %d: "
+                                           "'\\' on the end of the last line "
+                                           "ignored."),
+                                       strFileName.c_str(),
+                                       nLine + 1);
+                        }
+                        else {
+                            // pass to the beginning of the next line
+                            pc = file[++nLine].c_str();
+
+                            // skip pc++ at the end of the loop
+                            continue;
+                        }