Address issues find by manual coverity scan.
diff --git a/library/debug.c b/library/debug.c
index a032478..a9cd814 100644
--- a/library/debug.c
+++ b/library/debug.c
@@ -86,7 +86,7 @@
     char str[DEBUG_BUF_SIZE];
     int ret;
 
-    if( ssl->conf == NULL || ssl->conf->f_dbg == NULL || level > debug_threshold )
+    if( NULL == ssl || NULL == ssl->conf || NULL == ssl->conf->f_dbg || level > debug_threshold )
         return;
 
     va_start( argp, format );
diff --git a/library/ssl_tls.c b/library/ssl_tls.c
index 9208ec9..80a908d 100644
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -5773,7 +5773,7 @@
 {
     mbedtls_ecjpake_role role;
 
-    if( ssl->handshake == NULL && ssl->conf == NULL )
+    if( ssl->handshake == NULL || ssl->conf == NULL )
         return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
 
     if( ssl->conf->endpoint == MBEDTLS_SSL_IS_SERVER )