2
0

Return error on unknown oid while decoding record instead of panic

This commit is contained in:
Iurii Krasnoshchok
2017-12-20 14:47:52 +01:00
parent a01653c3df
commit e22e7e67ec
+4 -3
View File
@@ -98,9 +98,10 @@ func (dst *Record) DecodeBinary(ci *ConnInfo, src []byte) error {
var binaryDecoder BinaryDecoder
if dt, ok := ci.DataTypeForOID(fieldOID); ok {
if binaryDecoder, ok = dt.Value.(BinaryDecoder); !ok {
return errors.Errorf("unknown oid while decoding record: %v", fieldOID)
}
binaryDecoder, _ = dt.Value.(BinaryDecoder)
}
if binaryDecoder == nil {
return errors.Errorf("unknown oid while decoding record: %v", fieldOID)
}
var fieldBytes []byte