From f2f19d7161809218d6150fc54142b002e571c0fe Mon Sep 17 00:00:00 2001 From: micrusa Date: Mon, 27 Apr 2020 12:57:02 +0200 Subject: [PATCH] Fix java.lang.NullPointerException: Attempt to get length of null array Signed-off-by: micrusa --- .../main/java/me/micrusa/amaztimer/utils/latestTraining.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/me/micrusa/amaztimer/utils/latestTraining.java b/app/src/main/java/me/micrusa/amaztimer/utils/latestTraining.java index 9fd461b0..4a4b1429 100644 --- a/app/src/main/java/me/micrusa/amaztimer/utils/latestTraining.java +++ b/app/src/main/java/me/micrusa/amaztimer/utils/latestTraining.java @@ -9,9 +9,12 @@ public class latestTraining { private defValues defValues = new defValues(); - private int[] hrArray = new int[0]; + private int[] hrArray = null; public void addHrValue(int value){ + if(this.hrArray == null){ + this.hrArray = new int[0]; + } int[] newArray = new int[this.hrArray.length + 1]; for(int i=0; i