File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -53,12 +53,15 @@ def main():
53
53
elif args .fit_strategy == 'min_height' :
54
54
fit_strategy = FitStrategy .MINIMIZE_HEIGHT
55
55
56
- qr = _make_qr (
57
- args .DATA ,
58
- ecc = ecc ,
59
- version = args .version ,
60
- fit_strategy = fit_strategy
61
- )
56
+ try :
57
+ qr = _make_qr (
58
+ args .DATA ,
59
+ ecc = ecc ,
60
+ version = args .version ,
61
+ fit_strategy = fit_strategy
62
+ )
63
+ except DataTooLongError :
64
+ _show_error_and_exit ("Error: The data is too long." )
62
65
63
66
_save_image (qr , args .OUTPUT )
64
67
Original file line number Diff line number Diff line change @@ -265,6 +265,9 @@ def _put_data(self, data):
265
265
encoded_data = self ._convert_to_bites_data (data , character_count_length , codewords_total )
266
266
codewords = split_into_8bits (encoded_data )
267
267
268
+ if len (codewords ) > codewords_total :
269
+ raise DataTooLongError ("The data is too long." )
270
+
268
271
# codeword数に満たない場合は規定の文字列を付与する
269
272
while True :
270
273
if len (codewords ) >= codewords_total :
You can’t perform that action at this time.
0 commit comments