SILC_IS_FD_STREAM and SILC_IS_SOCKET_STREAM now checks for NULL stream.
authorPekka Riikonen <priikone@silcnet.org>
Sat, 12 Apr 2008 10:51:06 +0000 (13:51 +0300)
committerPekka Riikonen <priikone@silcnet.org>
Sat, 12 Apr 2008 10:51:06 +0000 (13:51 +0300)
lib/silcutil/silcfdstream.c
lib/silcutil/silcsocketstream_i.h

index a618c63421c1c5921df3ff17b49f053010e48602..1ae8d413ca730fd7c67880522ea7604052edcd69 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 2005 - 2007 Pekka Riikonen
+  Copyright (C) 2005 - 2008 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@
 
 /************************** Types and definitions ***************************/
 
-#define SILC_IS_FD_STREAM(s) (s->ops == &silc_fd_stream_ops)
+#define SILC_IS_FD_STREAM(s) (s && s->ops == &silc_fd_stream_ops)
 
 const SilcStreamOps silc_fd_stream_ops;
 
index 50385df3bddd38233031412e16383475bf78998d..13013f25ac3a75af7f33cec384c05d7b63cc8dca 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 2005 - 2006 Pekka Riikonen
+  Copyright (C) 2005 - 2008 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -56,8 +56,8 @@ struct SilcSocketStreamStruct {
   unsigned int connected : 1;      /* UDP connected state */
 };
 
-#define SILC_IS_SOCKET_STREAM(s) (s->ops == &silc_socket_stream_ops)
-#define SILC_IS_SOCKET_STREAM_UDP(s) (s->ops == &silc_socket_udp_stream_ops)
+#define SILC_IS_SOCKET_STREAM(s) (s && s->ops == &silc_socket_stream_ops)
+#define SILC_IS_SOCKET_STREAM_UDP(s) (s && s->ops == &silc_socket_udp_stream_ops)
 
 extern const SilcStreamOps silc_socket_stream_ops;
 extern const SilcStreamOps silc_socket_udp_stream_ops;