diff --git a/cluster_analyticsquery.go b/cluster_analyticsquery.go
index <HASH>..<HASH> 100644
--- a/cluster_analyticsquery.go
+++ b/cluster_analyticsquery.go
@@ -425,7 +425,7 @@ func (c *Cluster) doAnalyticsQuery(tracectx opentracing.SpanContext, b *Bucket, 
 			return nil, err
 		}
 
-		if !retryBehavior.CanRetry(retries) {
+		if retryBehavior == nil || !retryBehavior.CanRetry(retries) {
 			break
 		}
 
diff --git a/cluster_searchquery.go b/cluster_searchquery.go
index <HASH>..<HASH> 100644
--- a/cluster_searchquery.go
+++ b/cluster_searchquery.go
@@ -260,7 +260,7 @@ func (c *Cluster) doSearchQuery(tracectx opentracing.SpanContext, b *Bucket, q *
 			return nil, err
 		}
 
-		if !retryBehavior.CanRetry(retries) {
+		if retryBehavior == nil || !retryBehavior.CanRetry(retries) {
 			break
 		}
Check that retrybehavior is not nil before using.

Motivation
----------
It's possible for a user to provide a retrybehavior for search or
analytics so we should check that they aren't nil before use.

Changes
-------
Added nil checks before use in search and analytics query execution.

Change-Id: I8c<I>b9bf<I>fded<I>b<I>d<I>b8f
Reviewed-on: <URL>