aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ber/marshal.go7
-rw-r--r--unmarshal/main.go2
2 files changed, 7 insertions, 2 deletions
diff --git a/ber/marshal.go b/ber/marshal.go
index aaca0c2..6124197 100644
--- a/ber/marshal.go
+++ b/ber/marshal.go
@@ -101,5 +101,10 @@ func structEncoder(e *encodeState, v reflect.Value) {
}
func sliceEncoder(e *encodeState, v reflect.Value) {
- e.Write(v.Bytes())
+ if v.IsNil() {
+ e.Write(MarshalClass(classUniversal, kindPrimitive, tagNull))
+ e.Write([]byte{0})
+ } else {
+ e.Write(v.Bytes())
+ }
}
diff --git a/unmarshal/main.go b/unmarshal/main.go
index b04df04..7f4de58 100644
--- a/unmarshal/main.go
+++ b/unmarshal/main.go
@@ -11,7 +11,7 @@ func main() {
pdu := rose.Invoke{
InvokeId: 2,
Opcode: 511,
- Argument: []byte{2, 1, 0},
+ Argument: nil,
}
b, err := ber.Marshal(pdu)
fmt.Println(err, b)