From 8667efaf4448e9033aa09fd105b0bc741efd9092 Mon Sep 17 00:00:00 2001
From: Lyberta <lyberta@lyberta.net>
Date: Sat, 25 Nov 2017 00:53:13 +0300
Subject: [PATCH] Disallow changing to invalid team. Fixes #1964.

---
 qcsrc/server/teamplay.qc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc
index 12aca2133a..fd73969cb8 100644
--- a/qcsrc/server/teamplay.qc
+++ b/qcsrc/server/teamplay.qc
@@ -925,6 +925,11 @@ void SV_ChangeTeam(entity this, float _color)
 	source_team = Team_TeamToNumber(source_color + 1);
 	destination_team = Team_TeamToNumber(destination_color + 1);
 
+	if (destination_team == -1)
+	{
+		return;
+	}
+
 	CheckAllowedTeams(this);
 
 	if (destination_team == 1 && c1 < 0) destination_team = 4;
-- 
2.39.5