Fix a segfault on reload introduced by the pacing changes.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 23 Mar 2014 16:31:25 +0000 (17:31 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 23 Mar 2014 16:31:25 +0000 (17:31 +0100)
client.cpp

index eea41a5..d0ab8f8 100644 (file)
@@ -84,9 +84,11 @@ Client::Client(const ClientProto &serialized, Stream *stream)
                }
                fwmark = 0;
        }
-       if (setsockopt(sock, SOL_SOCKET, SO_MAX_PACING_RATE, &stream->pacing_rate, sizeof(stream->pacing_rate)) == -1) {
-               if (stream->pacing_rate != ~0U) {
-                       log_perror("setsockopt(SO_MAX_PACING_RATE)");
+       if (stream != NULL) {
+               if (setsockopt(sock, SOL_SOCKET, SO_MAX_PACING_RATE, &stream->pacing_rate, sizeof(stream->pacing_rate)) == -1) {
+                       if (stream->pacing_rate != ~0U) {
+                               log_perror("setsockopt(SO_MAX_PACING_RATE)");
+                       }
                }
        }
 }