stagefright: avoid crash when histogram option is used
if decodeTimesUs vector is null then it will lead to a segfault when decodeTimesUs->itemAt is called
Test: stagefright -x -S -s <a_video_file>; stagefright -x -S -r <a_video_file>; stagefright -x -s <a_video_file>
Change-Id: I3a5f283d3eecfefa3bdb9ad84385697ab3b1738e
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);