From 929798ea2747657e5834da459d4abb9bb41d71b0 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Sat, 12 Apr 2008 13:51:06 +0300 Subject: [PATCH] SILC_IS_FD_STREAM and SILC_IS_SOCKET_STREAM now checks for NULL stream. --- lib/silcutil/silcfdstream.c | 4 ++-- lib/silcutil/silcsocketstream_i.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/silcutil/silcfdstream.c b/lib/silcutil/silcfdstream.c index a618c634..1ae8d413 100644 --- a/lib/silcutil/silcfdstream.c +++ b/lib/silcutil/silcfdstream.c @@ -4,7 +4,7 @@ Author: Pekka Riikonen - 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; diff --git a/lib/silcutil/silcsocketstream_i.h b/lib/silcutil/silcsocketstream_i.h index 50385df3..13013f25 100644 --- a/lib/silcutil/silcsocketstream_i.h +++ b/lib/silcutil/silcsocketstream_i.h @@ -4,7 +4,7 @@ Author: Pekka Riikonen - 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; -- 2.24.0