Merge "stagefright: avoid crash when histogram option is used" into main am: 2410aa74d1 am: 8a009cb5fa am: e6d71cbfab am: 8b76440534 am: 23327e95c8

Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/2647899

Change-Id: I83582d3f092192f39d9615e1f5c994886b1262b4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/cmds/stagefright/stagefright.cpp b/cmds/stagefright/stagefright.cpp
index 2edc0fe..379f244 100644
--- a/cmds/stagefright/stagefright.cpp
+++ b/cmds/stagefright/stagefright.cpp
@@ -106,6 +106,12 @@
     decodeTimesUs->sort(CompareIncreasing);
 
     size_t n = decodeTimesUs->size();
+
+    if (n == 0) {
+        printf("no decode histogram to display\n");
+        return;
+    }
+
     int64_t minUs = decodeTimesUs->itemAt(0);
     int64_t maxUs = decodeTimesUs->itemAt(n - 1);