don't try to generate 0-size qrcodes (#267)

This commit is contained in:
m2049r 2018-04-29 11:21:50 +02:00 committed by GitHub
parent 425246beb1
commit d18999e731
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -335,6 +335,7 @@ public class ReceiveFragment extends Fragment {
} }
public Bitmap generate(String text, int width, int height) { public Bitmap generate(String text, int width, int height) {
if ((width <= 0) || (height <= 0)) return null;
Map<EncodeHintType, Object> hints = new HashMap<>(); Map<EncodeHintType, Object> hints = new HashMap<>();
hints.put(EncodeHintType.CHARACTER_SET, "utf-8"); hints.put(EncodeHintType.CHARACTER_SET, "utf-8");
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M); hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M);