From 12c1b4f44bb1739b8b10270c0787522df5ef1167 Mon Sep 17 00:00:00 2001 From: CGantert345 <57003061+CGantert345@users.noreply.github.com> Date: Mon, 2 May 2022 09:52:02 +0200 Subject: null pointer exception fixed --- src/main/java/org/uic/barcode/utils/SecurityUtils.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/uic/barcode/utils/SecurityUtils.java b/src/main/java/org/uic/barcode/utils/SecurityUtils.java index 1fcc18a..fc6a135 100644 --- a/src/main/java/org/uic/barcode/utils/SecurityUtils.java +++ b/src/main/java/org/uic/barcode/utils/SecurityUtils.java @@ -68,7 +68,10 @@ public class SecurityUtils { String name = key.getAlgorithm(); byte[] keyBytes = key.getEncoded(); - + + if (keyBytes == null || keyBytes.length == 0) { + return null; + } PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes); -- cgit v1.2.3