diff --git a/load/frame-page.js b/load/frame-page.js index 239289f..ab2f615 100644 --- a/load/frame-page.js +++ b/load/frame-page.js @@ -244,28 +244,29 @@ PageFrame.prototype.loadMessage = function(page) { // if this message is to the user, and the msg number > scan_ptr and it is the next message on the user's new mail list var newmsgs = area.newMsgsToMe(); var next; - log(LOG_DEBUG,'User has: '+newmsgs.length+' msgs to read to ME'); + log(LOG_DEBUG,'User has: '+newmsgs.length-1+' msgs to read to ME'); if (newmsgs.length) { next = newmsgs[1]; - log(LOG_DEBUG,'- NEXT is: '+next.tags+', this is: '+msg.tags); + //log(LOG_DEBUG,'- NEXT is: '+next.tags+', this is: '+msg.tags); - if (next.tags === msg.tags) { + if (next && (next.tags === msg.tags)) { log(LOG_DEBUG,'- Updating scan_ptr to: '+next.number); stats.scan_ptr = next.number; } // Last message next = newmsgs[0]; - log(LOG_DEBUG,'- LAST TO ME is: '+next.tags); if (next !== undefined) { + log(LOG_DEBUG,'- LAST TO ME is: '+next.tags); this.key[1] = area.page(next.tags); } // Next new message next = newmsgs[2]; - log(LOG_DEBUG,'- NEXT TO ME is: '+next.tags); - if (next !== undefined) + if (next !== undefined) { + log(LOG_DEBUG,'- NEXT TO ME is: '+next.tags); this.key[2] = area.page(next.tags); + } } // if this message is the next message, update last_read