don't let the lookup return nil
This commit is contained in:
parent
28b6092ea3
commit
3e9789880d
2 changed files with 4 additions and 3 deletions
|
@ -89,11 +89,11 @@ class HuffmanEncoding
|
|||
end
|
||||
|
||||
def encode(entry)
|
||||
self.lookup.invert[entry]
|
||||
self.lookup.invert[entry] || ""
|
||||
end
|
||||
|
||||
def decode(code)
|
||||
self.lookup[code]
|
||||
self.lookup[code] || ""
|
||||
end
|
||||
|
||||
def encode_list(list)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue