[VOL-1519]  Bug fix when deleting a device

Change-Id: I4e1f42d0c3f43e9778fd007b149f3711fb9f69f0
diff --git a/db/kvstore/etcdclient.go b/db/kvstore/etcdclient.go
index 1d2031d..42ab83c 100644
--- a/db/kvstore/etcdclient.go
+++ b/db/kvstore/etcdclient.go
@@ -407,6 +407,10 @@
 
 	channels, exists = c.watchedChannels.Load(key)
 
+	if channels == nil {
+		return nil, exists
+	}
+
 	return channels.([]map[chan *Event]v3Client.Watcher), exists
 }
 
diff --git a/rw_core/core/adapter_proxy.go b/rw_core/core/adapter_proxy.go
index 5d21838..ebc79ba 100644
--- a/rw_core/core/adapter_proxy.go
+++ b/rw_core/core/adapter_proxy.go
@@ -86,12 +86,6 @@
 	}
 	// Use a device topic for the response as we are the only core handling requests for this device
 	replyToTopic := ap.getCoreTopic()
-	//if !ap.deviceTopicRegistered {
-	//	if err := ap.kafkaICProxy.SubscribeWithDefaultRequestHandler(replyToTopic, kafka.OffsetOldest); err != nil {
-	//		log.Errorw("Unable-to-subscribe-new-topic", log.Fields{"topic": replyToTopic, "error": err})
-	//		return err
-	//	}
-	//}
 	ap.deviceTopicRegistered = true
 	success, result := ap.kafkaICProxy.InvokeRPC(ctx, rpc, &toTopic, &replyToTopic, true, device.Id, args...)
 	log.Debugw("AdoptDevice-response", log.Fields{"replyTopic": replyToTopic, "deviceid": device.Id, "success": success})
@@ -165,12 +159,6 @@
 	success, result := ap.kafkaICProxy.InvokeRPC(ctx, rpc, &toTopic, &replyToTopic, true, device.Id, args...)
 	log.Debugw("DeleteDevice-response", log.Fields{"deviceid": device.Id, "success": success})
 
-	// We no longer need to have this device topic as we won't receive any unsolicited messages on it
-	if err := ap.kafkaICProxy.DeleteTopic(replyToTopic); err != nil {
-		log.Errorw("Unable-to-delete-topic", log.Fields{"topic": replyToTopic, "error": err})
-		return err
-	}
-
 	return unPackResponse(rpc, device.Id, success, result)
 }