From 96be0b594598f21c9de53dff6cc094649781a4cb Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 16 Apr 2020 16:54:13 +0200 Subject: [PATCH] Disallow marshalling for anotehr network --- downstream.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/downstream.go b/downstream.go index 4c6f16c..849745e 100644 --- a/downstream.go +++ b/downstream.go @@ -128,6 +128,9 @@ func (dc *downstreamConn) upstream() *upstreamConn { // user. func (dc *downstreamConn) marshalEntity(uc *upstreamConn, name string) string { if dc.network != nil { + if dc.network != uc.network { + panic("soju: tried to marshal an entity for another network") + } return name } if name == uc.nick { @@ -149,6 +152,9 @@ func (dc *downstreamConn) marshalUserPrefix(uc *upstreamConn, prefix *irc.Prefix return dc.prefix() } if dc.network != nil { + if dc.network != uc.network { + panic("soju: tried to marshal a user prefix for another network") + } return prefix } return &irc.Prefix{