From 74f33af22fdbb13bb5ffd6a0078fdcf637b25273 Mon Sep 17 00:00:00 2001
From: cyan <>
Date: Wed, 10 Dec 2003 04:38:07 +0000
Subject: [PATCH] Checking the nick change history no longer recurses, should
 be way faster, and fixes a crash problem involving 'infinite recursion.'

---
 exec/ircd.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/exec/ircd.js b/exec/ircd.js
index 75eac70089..5af5351093 100644
--- a/exec/ircd.js
+++ b/exec/ircd.js
@@ -435,10 +435,10 @@ function push_nickbuf(oldnick,newnick) {
 }
 
 function search_nickbuf(bufnick) {
-	for (nb=0;nb<NickHistory.length;nb++) {
-		if (NickHistory[nb] && (bufnick.toUpperCase() == NickHistory[nb].oldnick.toUpperCase())) {
+	for (nb=NickHistory.length-1;nb>-1;nb--) {
+		if (bufnick.toUpperCase() == NickHistory[nb].oldnick.toUpperCase()) {
 			if (!Users[NickHistory[nb].newnick.toUpperCase()])
-				return search_nickbuf(NickHistory[nb].newnick);
+				bufnick = NickHistory[nb].newnick;
 			else
 				return Users[NickHistory[nb].newnick.toUpperCase()];
 		}
-- 
GitLab