From 9c8c08ea1f67af29fbb66a2e85849ba76ac26279 Mon Sep 17 00:00:00 2001
From: Jake Taylor <jake@elixxir.io>
Date: Thu, 29 Apr 2021 12:15:55 -0500
Subject: [PATCH] prevent updating with an empty ndf

---
 network/gateway/hostPool.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/network/gateway/hostPool.go b/network/gateway/hostPool.go
index 173ca2e2a..ad3da5b24 100644
--- a/network/gateway/hostPool.go
+++ b/network/gateway/hostPool.go
@@ -125,6 +125,11 @@ func newHostPool(poolParams PoolParams, rng *fastRNG.StreamGenerator, ndf *ndf.N
 
 // UpdateNdf Mutates internal ndf to the given ndf
 func (h *HostPool) UpdateNdf(ndf *ndf.NetworkDefinition) {
+	if len(ndf.Gateways) == 0 {
+		jww.WARN.Printf("Unable to UpdateNdf: no gateways available")
+		return
+	}
+
 	h.ndfMux.Lock()
 	h.ndf = ndf
 
-- 
GitLab