Add empty check for path in UsageGraph

If path is empty, skip method since there is nothing to draw.

Bug: 132728523
Test: RunSettingsRoboTests
Change-Id: I6fdb7c2f69d3d658c47b58c7304cfeb7d4010a46
This commit is contained in:
Lei Yu
2019-05-15 11:14:14 -07:00
parent 2e26605065
commit 7db71f91bf
2 changed files with 17 additions and 1 deletions

View File

@@ -288,7 +288,11 @@ public class UsageGraph extends View {
canvas.drawPath(mPath, paint);
}
private void drawFilledPath(Canvas canvas, SparseIntArray localPaths, Paint paint) {
@VisibleForTesting
void drawFilledPath(Canvas canvas, SparseIntArray localPaths, Paint paint) {
if (localPaths.size() == 0) {
return;
}
mPath.reset();
float lastStartX = localPaths.keyAt(0);
mPath.moveTo(localPaths.keyAt(0), localPaths.valueAt(0));