File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -527,12 +527,18 @@ def decompress(self, compressed):
527
527
power = 1
528
528
529
529
while power != maxpower :
530
- resb = data_val & data_position
530
+ if data_val is not None :
531
+ resb = data_val & data_position
532
+ else :
533
+ resb = 0
531
534
data_position >>= 1
532
535
533
536
if data_position == 0 :
534
537
data_position = 32768
535
- data_val = ord (data_string [data_index ])
538
+ if data_index < len (data_string ):
539
+ data_val = ord (data_string [data_index ])
540
+ else :
541
+ data_val = None
536
542
data_index += 1
537
543
538
544
bits |= (1 if resb > 0 else 0 ) * power
@@ -555,12 +561,18 @@ def decompress(self, compressed):
555
561
power = 1
556
562
557
563
while power != maxpower :
558
- resb = data_val & data_position
564
+ if data_val is not None :
565
+ resb = data_val & data_position
566
+ else :
567
+ resb = 0
559
568
data_position >>= 1
560
569
561
570
if data_position == 0 :
562
571
data_position = 32768
563
- data_val = ord (data_string [data_index ])
572
+ if data_index < len (data_string ):
573
+ data_val = ord (data_string [data_index ])
574
+ else :
575
+ data_val = None
564
576
data_index += 1
565
577
566
578
bits |= (1 if resb > 0 else 0 ) * power
You can’t perform that action at this time.
0 commit comments