diff --git a/u9/huffman_tree.py b/u9/huffman_tree.py index aacff23..1809f7e 100644 --- a/u9/huffman_tree.py +++ b/u9/huffman_tree.py @@ -74,6 +74,8 @@ class HuffmanTree: def decode(self, bits): if self.root is None: return "" + if self.root.left is None and self.root.right is None: + return self.root.data * len(bits) decodtext = "" node = self.root for i in bits: