From 09868ec493e9bcd0b161b89ed1e21061a76a59be Mon Sep 17 00:00:00 2001
From: dogan <gfldogan@gmail.com>
Date: Tue, 17 Nov 2020 20:00:07 +0100
Subject: [PATCH] ConnectAnnounce: neon is kinda sus

---
 ConnectAnnounce/scripting/ConnectAnnounce.sp | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/ConnectAnnounce/scripting/ConnectAnnounce.sp b/ConnectAnnounce/scripting/ConnectAnnounce.sp
index 99696589..07eb8e1d 100644
--- a/ConnectAnnounce/scripting/ConnectAnnounce.sp
+++ b/ConnectAnnounce/scripting/ConnectAnnounce.sp
@@ -300,14 +300,17 @@ public void TQueryCB(Handle owner, Handle rs, const char[] error, any data)
 	}
 
 	int iRank = -1;
-	if (SQL_GetRowCount(rs) > 0)
+	if ((rs != INVALID_HANDLE))
 	{
-		int iField;
+		if (SQL_GetRowCount(rs) > 0)
+		{
+			int iField;
 
-		SQL_FetchRow(rs);
-		SQL_FieldNameToNum(rs, "rank", iField);
-		iRank = SQL_FetchInt(rs, iField);
-		iRank += 1;
+			SQL_FetchRow(rs);
+			SQL_FieldNameToNum(rs, "rank", iField);
+			iRank = SQL_FetchInt(rs, iField);
+			iRank += 1;
+		}
 	}
 	Handle hFile = OpenFile(g_sDataFile, "r");
 	static char sRawMsg[301];