Skip to content

Commit

Permalink
fix: work with unkown enum values
Browse files Browse the repository at this point in the history
  • Loading branch information
stakach committed Jul 31, 2021
1 parent 9e55ba0 commit ba56163
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion shard.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: bindata
version: 1.9.0
version: 1.9.1
crystal: ">= 1.0.0"

development_dependencies:
Expand Down
2 changes: 1 addition & 1 deletion src/bindata.cr
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ abstract class BinData
{% end %}

def {{name.var}} : {{name.type}}
{{name.type}}.from_value(@{{name.var}}.to_i)
{{name.type}}.new(@{{name.var}}.to_i)
end

def {{name.var}}=(value : {{name.type}})
Expand Down
4 changes: 2 additions & 2 deletions src/bindata/asn1.cr
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module ASN1

def tag
raise "only valid for universal tags" unless tag_class == TagClass::Universal
UniversalTags.from_value tag_number
UniversalTags.new tag_number.to_i
end

def extended?
Expand Down Expand Up @@ -101,7 +101,7 @@ module ASN1
# Check if this can be expanded into multiple sub-entries
def sequence?
return false unless tag_class == TagClass::Universal
tag = UniversalTags.from_value tag_number
tag = UniversalTags.new tag_number.to_i
constructed && {UniversalTags::Sequence, UniversalTags::Set}.includes?(tag)
end

Expand Down

0 comments on commit ba56163

Please sign in to comment.