From 96a85010de73f1149700e6556350fd270ac2f9e2 Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Tue, 1 Oct 2013 00:26:04 +0000
Subject: [PATCH] Handle the possiblity of the same date being in the dates
 array more than once.

---
 exec/load/msgutils.js | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/exec/load/msgutils.js b/exec/load/msgutils.js
index e17dbd9cb6..fbeda60552 100644
--- a/exec/load/msgutils.js
+++ b/exec/load/msgutils.js
@@ -476,11 +476,13 @@ function getMessageThreads(sub, max) {
 	
 	threads.dates.sort(function (a,b) {return b - a});
 	for(var d = 0; d < threads.dates.length; d++) {
-		for(var t in threads.thread) {
-			if(threads.thread[t].newest != threads.dates[d])
-				continue;
-			threads.order.push(t);
-			break;
+		if(threads.dates[d] !== threads.dates[d+1]) {
+			for(var t in threads.thread) {
+				if(threads.thread[t].newest != threads.dates[d])
+					continue;
+				threads.order.push(t);
+				break;
+			}
 		}
 	}
 	log(LOG_INFO, "Messages threaded in " + (system.timer - stime) + " seconds.");
-- 
GitLab