summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2008-12-26 21:18:18 (GMT)
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2008-12-26 21:18:18 (GMT)
commit7f0ced1fbd4b4ab57f9ceb882f665aaf8fb42800 (patch)
tree85d308b853953b5825717a87a28224f4e1a1a21c
parentca7d2af53fad18cfb6d3ecc851156f60a2786ab3 (diff)
downloadtictactube-7f0ced1fbd4b4ab57f9ceb882f665aaf8fb42800.tar.gz
tictactube-7f0ced1fbd4b4ab57f9ceb882f665aaf8fb42800.tar.xz
Check the iterator for NULL correctly and skip lines that couldn't be split
-rw-r--r--src/ttt-net-stream-tube.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/ttt-net-stream-tube.c b/src/ttt-net-stream-tube.c
index 5d8d3a0..b51b817 100644
--- a/src/ttt-net-stream-tube.c
+++ b/src/ttt-net-stream-tube.c
@@ -306,10 +306,14 @@ ttt_net_stream_tube_channel_cb (GIOChannel *channel,
messages = g_strsplit (buffer, ";", -1);
- for (iter = messages; **iter != NULL; iter++)
+ for (iter = messages; *iter != NULL; iter++)
{
gchar **message = g_strsplit (*iter, " ", -1);
- if (strcmp (message[0], "added") == 0)
+ if (message[0] == NULL)
+ {
+ /* noop */
+ }
+ else if (strcmp (message[0], "added") == 0)
{
player_number = atoi (message[1]);
g_signal_emit (net, signals[PLAYER_ADDED], 0, player_number);