Fix dependency issues
diff --git a/library/ssl_srv.c b/library/ssl_srv.c
index 3e2b901..b442e65 100644
--- a/library/ssl_srv.c
+++ b/library/ssl_srv.c
@@ -2725,9 +2725,12 @@
      * opaque DistinguishedName<1..2^16-1>;
      */
     p += 2;
-    crt = ssl->handshake->sni_ca_chain != NULL ?
-          ssl->handshake->sni_ca_chain :
-          ssl->conf->ca_chain;
+#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)
+    if( ssl->handshake->sni_ca_chain != NULL )
+        crt = ssl->handshake->sni_ca_chain;
+    else
+#endif
+        crt = ssl->conf->ca_chain;
 
     total_dn_size = 0;
     while( crt != NULL && crt->version != 0 )