]> diplodocus.org Git - nmh/blobdiff - sbr/m_convert.c
More code converted to use argsplit().
[nmh] / sbr / m_convert.c
index c88747f09e0de9008adf99e2316b1351a605f726..496978ee9fbfdc4b9a7220a4f0e4baad0f7067bc 100644 (file)
@@ -181,6 +181,18 @@ single:
         * check if message is in-range and exists.
         */
        if (mp->msgflags & ALLOW_NEW) {
+           /*
+            * We can get into a case where the "cur" sequence is way out
+            * of range, and because it's allowed to not exist (think
+            * of "rmm; next") it doesn't get checked to make sure it's
+            * within the range of messages in seq_init().  So if our
+            * desired sequence is out of range of the allocated folder
+            * limits simply reallocate the folder so it's within range.
+            */
+           if (first < mp->lowoff || first > mp->hghoff)
+               mp = folder_realloc(mp, first < mp->lowoff ? first : mp->lowoff,
+                                   first > mp->hghoff ? first : mp->hghoff);
+
            set_select_empty (mp, first);
        } else {
            if (first > mp->hghmsg