1
mirror of https://gitlab.com/jessieh/qrprinter.git synced 2024-11-24 07:21:46 +00:00

Fix segfault when encoding 0-length string

This commit is contained in:
Jessie Hildebrandt 2021-12-11 20:39:46 -05:00
parent d53b412e06
commit 3a83ed14e0

View File

@ -81,7 +81,9 @@ Black modules will be printed as `black_cell`, and white modules will be printed
(fn encode_string [string] (fn encode_string [string]
"Encode string `string` into a table representing a QR code. "Encode string `string` into a table representing a QR code.
Returns a 2D sequential table of true/false values representing black/white QR modules." Returns a 2D sequential table of true/false values representing black/white QR modules."
(qrencode.encode_string_8_bit string)) (if (~= (string.len string) 0)
(qrencode.encode_string_8_bit string)
nil))
(fn print_qr_ascii [qr options] (fn print_qr_ascii [qr options]
"Print QR code `qr` to stdout using ASCII characters." "Print QR code `qr` to stdout using ASCII characters."