wstrange / asn1lib

Dart ASN1 Encoder / Decoder
BSD 2-Clause "Simplified" License
30 stars 31 forks source link

Issue with ASN1Null #26

Closed dpjanes closed 5 years ago

dpjanes commented 5 years ago

I'm new to ASN1, but this feels to me like it should work

import 'package:asn1lib/asn1lib.dart';

main(List<String> arguments) {
    ASN1Sequence inner = ASN1Sequence();
    inner.add(ASN1Null());

    print("${inner.encodedBytes}");
}

But instead we get

NoSuchMethodError: The method '<=' was called on null.
Receiver: null
Tried calling: <=(127)
#0      Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:50:5)
#1      ASN1Length.encodeLength (file:///Users/david/.pub-cache/hosted/pub.dartlang.org/asn1lib-0.5.3/lib/asn1length.dart:34:16)
#2      ASN1Object._encodeHeader (file:///Users/david/.pub-cache/hosted/pub.dartlang.org/asn1lib-0.5.3/lib/asn1object.dart:123:36)
#3      ASN1Object._encode (file:///Users/david/.pub-cache/hosted/pub.dartlang.org/asn1lib-0.5.3/lib/asn1object.dart:135:26)
#4      ASN1Sequence._childLength.<anonymous closure> (file:///Users/david/.pub-cache/hosted/pub.dartlang.org/asn1lib-0.5.3/lib/asn1sequence.dart:53:16)
#5      List.forEach (dart:core/runtime/libgrowable_array.dart:277:8)
#6      ASN1Sequence._childLength (file:///Users/david/.pub-cache/hosted/pub.dartlang.org/asn1lib-0.5.3/lib/asn1sequence.dart:52:14)
#7      ASN1Sequence._encode (file:///Users/david/.pub-cache/hosted/pub.dartlang.org/asn1lib-0.5.3/lib/asn1sequence.dart:37:23)
#8      ASN1Object.encodedBytes (file:///Users/david/.pub-cache/hosted/pub.dartlang.org/asn1lib-0.5.3/lib/asn1object.dart:38:7)
#9      main (file:///Users/david/flutter/x509/bin/xxx.dart:7:20)
#10     _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:287:32)
#11     _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
wstrange commented 5 years ago

Fixed with 0.5.4

Thanks for the issue report!!!