Skip to content

Commit

Permalink
Fixed an ArrayIndexOutOfBoundsException when summarising completely e…
Browse files Browse the repository at this point in the history
…mpty data - why does that happen? who knows.
  • Loading branch information
fridgecow committed Jan 23, 2018
1 parent b8aabc9 commit f35ca35
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified app/release/app-release.apk
Binary file not shown.
2 changes: 1 addition & 1 deletion app/release/output.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":172},"path":"app-release.apk","properties":{"packageId":"com.fridgecow.smartalarm","split":"","minSdkVersion":"25"}}]
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":173},"path":"app-release.apk","properties":{"packageId":"com.fridgecow.smartalarm","split":"","minSdkVersion":"25"}}]
8 changes: 7 additions & 1 deletion app/src/main/java/com/fridgecow/smartalarm/SleepData.java
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,13 @@ public double getSDNNAt(double time){
}

public double getTimeAt(int index){
return mSleepMotion.get(index).getX();
if(index < 0){
return mSleepMotion.get(0).getX();
}else if(index >= mSleepMotion.size()){
return mSleepMotion.get(mSleepMotion.size() -1).getX();
}else {
return mSleepMotion.get(index).getX();
}
}

public double getMotionMean(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public SleepSummaryData(SleepData data){
}

//Deal with last section
if(!sleeping){
if(!sleeping && data.getDataLength() > 0){
add(new DataRegion(
lastTime,
data.getTimeAt(data.getDataLength()-1),
Expand Down

0 comments on commit f35ca35

Please sign in to comment.