diff options
author | James Dong <jdong@google.com> | 2010-02-04 18:08:06 -0800 |
---|---|---|
committer | James Dong <jdong@google.com> | 2010-02-04 18:11:32 -0800 |
commit | b93ad64a423975748c7f5e1a5ea94ab8681bc899 (patch) | |
tree | ed9b6df646a893ade81f560e90c0dc33adaae132 /cmds | |
parent | b399aa37056a3ce7a38b4a20cc0aef8e0e01b23e (diff) | |
download | frameworks_av-b93ad64a423975748c7f5e1a5ea94ab8681bc899.zip frameworks_av-b93ad64a423975748c7f5e1a5ea94ab8681bc899.tar.gz frameworks_av-b93ad64a423975748c7f5e1a5ea94ab8681bc899.tar.bz2 |
When the extractor is not able to be created successfully, don't crash
Diffstat (limited to 'cmds')
-rw-r--r-- | cmds/stagefright/record.cpp | 3 | ||||
-rw-r--r-- | cmds/stagefright/stagefright.cpp | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/cmds/stagefright/record.cpp b/cmds/stagefright/record.cpp index 2ec0b70..845c854 100644 --- a/cmds/stagefright/record.cpp +++ b/cmds/stagefright/record.cpp @@ -106,6 +106,9 @@ sp<MediaSource> createSource(const char *filename) { sp<MediaExtractor> extractor = MediaExtractor::Create(new FileSource(filename)); + if (extractor == NULL) { + return NULL; + } size_t num_tracks = extractor->countTracks(); diff --git a/cmds/stagefright/stagefright.cpp b/cmds/stagefright/stagefright.cpp index e65cdf1..f7cb227 100644 --- a/cmds/stagefright/stagefright.cpp +++ b/cmds/stagefright/stagefright.cpp @@ -431,6 +431,10 @@ int main(int argc, char **argv) { mediaSource = new JPEGSource(dataSource); } else { sp<MediaExtractor> extractor = MediaExtractor::Create(dataSource); + if (extractor == NULL) { + fprintf(stderr, "could not create data source\n"); + return -1; + } size_t numTracks = extractor->countTracks(); |