diff --git a/admin/judges_teams_timeslots.php b/admin/judges_teams_timeslots.php
index 1ee5f51a..61901e93 100644
--- a/admin/judges_teams_timeslots.php
+++ b/admin/judges_teams_timeslots.php
@@ -93,15 +93,20 @@ function checkinvert(what)
  {
 	//the db handles the uniqueness (to ensure the same timeslot isnt assigned to the same team more than once)
 	//so all we'll do here is just mass insert without regards for whats already there.
-	foreach($_POST['teams'] AS $tm)
+	if(count($_POST['teams']) && count($_POST['timeslots']) 
 	{
-		foreach($_POST['timeslots'] AS $ts)
+		foreach($_POST['teams'] AS $tm)
 		{
-			mysql_query("INSERT INTO judges_teams_timeslots_link (judges_teams_id,judges_timeslots_id,year) VALUES ('$tm','$ts','".$config['FAIRYEAR']."')");
+			foreach($_POST['timeslots'] AS $ts)
+			{
+				mysql_query("INSERT INTO judges_teams_timeslots_link (judges_teams_id,judges_timeslots_id,year) VALUES ('$tm','$ts','".$config['FAIRYEAR']."')");
 
+			}
 		}
+		echo happy(i18n("%1 Timeslots assigned to %2 teams",array(count($_POST['timeslots']),count($_POST['teams']))));
 	}
-	echo happy(i18n("%1 Timeslots assigned to %2 teams",array(count($_POST['timeslots']),count($_POST['teams']))));
+	else
+		echo error(i18n("You must select both team(s) and timeslot(s) to assign"));
  }
 
  	echo "<form name=\"teamstimeslots\" method=\"post\" action=\"judges_teams_timeslots.php\">";