don't let the lookup return nil

This commit is contained in:
Vincent Batts 2012-08-06 14:37:28 -04:00
parent 28b6092ea3
commit 3e9789880d
2 changed files with 4 additions and 3 deletions

View file

@ -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)