mirror of
https://github.com/bettercap/bettercap
synced 2025-07-06 13:02:12 -07:00
misc: small fix or general refactoring i did not bother commenting
This commit is contained in:
parent
4206fd6a22
commit
1c3b9fc825
1 changed files with 14 additions and 11 deletions
|
@ -83,19 +83,22 @@ func (s *TcpProxyScript) OnData(from, to net.Addr, data []byte) []byte {
|
|||
return nil
|
||||
}
|
||||
|
||||
exported, err := ret.Export()
|
||||
if err != nil {
|
||||
log.Error("Error while exporting results: %s", err)
|
||||
return nil
|
||||
}
|
||||
// do we have any return value to override the buffer with?
|
||||
if !ret.IsNull() && !ret.IsUndefined() {
|
||||
exported, err := ret.Export()
|
||||
if err != nil {
|
||||
log.Error("Error while exporting results: %s", err)
|
||||
return nil
|
||||
}
|
||||
|
||||
array, ok := exported.([]byte)
|
||||
if !ok {
|
||||
log.Error("Error while casting exported value to array of byte: value = %s", exported)
|
||||
return nil
|
||||
}
|
||||
array, ok := exported.([]byte)
|
||||
if !ok {
|
||||
log.Error("Error while casting exported value to array of byte: value = %s", exported)
|
||||
return nil
|
||||
}
|
||||
|
||||
return array
|
||||
return array
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue