fix nil ptr exception (because GetType() returns a value even when pk is nil)

This commit is contained in:
sawka 2023-02-01 00:44:31 -08:00
parent a4b8819948
commit 3240b128e1

View File

@ -728,6 +728,9 @@ func RunInstallFromCmd(ctx context.Context, ecmd *exec.Cmd, tryDetect bool, mshe
case <-ctx.Done():
return ctx.Err()
}
if pk == nil {
return fmt.Errorf("no response packet received from client")
}
if pk.GetType() == packet.InitPacketStr && firstInit {
firstInit = false
initPacket := pk.(*packet.InitPacketType)