aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2017-01-04 21:42:16 +0100
committersteckbrief <steckbrief@chefmail.de>2017-01-04 21:42:16 +0100
commit955797a09048ee7497ca734c20626d3af5378404 (patch)
treed777ca167ab875cd2301d08bfa340415f35849ad
parent95cb2394154a287afcd295590d741096985ff69a (diff)
Fixed NPE in FileParams.setKeyAndIv
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/entities/FileParams.java24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/entities/FileParams.java b/src/main/java/de/thedevstack/conversationsplus/entities/FileParams.java
index 290b87b8..3abb37e4 100644
--- a/src/main/java/de/thedevstack/conversationsplus/entities/FileParams.java
+++ b/src/main/java/de/thedevstack/conversationsplus/entities/FileParams.java
@@ -93,17 +93,19 @@ public class FileParams {
}
public void setKeyAndIv(byte[] keyIvCombo) {
- if (keyIvCombo.length == 48) {
- this.aeskey = new byte[32];
- this.iv = new byte[16];
- System.arraycopy(keyIvCombo, 0, this.iv, 0, 16);
- System.arraycopy(keyIvCombo, 16, this.aeskey, 0, 32);
- } else if (keyIvCombo.length >= 32) {
- this.aeskey = new byte[32];
- System.arraycopy(keyIvCombo, 0, aeskey, 0, 32);
- } else if (keyIvCombo.length >= 16) {
- this.aeskey = new byte[16];
- System.arraycopy(keyIvCombo, 0, this.aeskey, 0, 16);
+ if (null != keyIvCombo) {
+ if (keyIvCombo.length == 48) {
+ this.aeskey = new byte[32];
+ this.iv = new byte[16];
+ System.arraycopy(keyIvCombo, 0, this.iv, 0, 16);
+ System.arraycopy(keyIvCombo, 16, this.aeskey, 0, 32);
+ } else if (keyIvCombo.length >= 32) {
+ this.aeskey = new byte[32];
+ System.arraycopy(keyIvCombo, 0, aeskey, 0, 32);
+ } else if (keyIvCombo.length >= 16) {
+ this.aeskey = new byte[16];
+ System.arraycopy(keyIvCombo, 0, this.aeskey, 0, 16);
+ }
}
}