qcacld-3.0: Add NULL check for qdf_ctx

Add NULL check for pointer qdf_ctx as it returned from call to
function 'cds_get_context' may be NULL and could be dereferenced.

Change-Id: Iea44cd1a2d20ee04d1720c4e8af1065320a589fd
CRs-Fixed: 1024778
diff --git a/core/sap/src/sap_ch_select.c b/core/sap/src/sap_ch_select.c
index 1792ff7..a00c48d 100644
--- a/core/sap/src/sap_ch_select.c
+++ b/core/sap/src/sap_ch_select.c
@@ -372,6 +372,12 @@
 	uint16_t unsafe_channel_count = 0;
 	qdf_device_t qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);
 
+	if (!qdf_ctx) {
+		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_FATAL,
+			  "qdf_ctx is NULL");
+		return;
+	}
+
 	/* Flush, default set all channel safe */
 	for (i = 0; i < NUM_CHANNELS; i++) {
 		safe_channels[i].isSafe = true;