diff options
author | Chong Zhang <chz@google.com> | 2014-09-22 12:25:36 -0700 |
---|---|---|
committer | Chong Zhang <chz@google.com> | 2014-09-22 12:28:26 -0700 |
commit | 217bde880be6f4d937caf9555ea98942883ebda0 (patch) | |
tree | ab27142abcd3b696ebac1c402e76e2634441bc0e /media/libstagefright/DataSource.cpp | |
parent | 2973994af39d55b58728df3dca067594e826ea2a (diff) | |
download | frameworks_av-217bde880be6f4d937caf9555ea98942883ebda0.zip frameworks_av-217bde880be6f4d937caf9555ea98942883ebda0.tar.gz frameworks_av-217bde880be6f4d937caf9555ea98942883ebda0.tar.bz2 |
fix crash when makeHTTPConnection fails with null pointer
Bug: 17608108
Change-Id: I4bdf6d09ae565418be3d6677b5ccac9072fb9b2c
Diffstat (limited to 'media/libstagefright/DataSource.cpp')
-rw-r--r-- | media/libstagefright/DataSource.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/media/libstagefright/DataSource.cpp b/media/libstagefright/DataSource.cpp index 9d6fd78..a72cbd5 100644 --- a/media/libstagefright/DataSource.cpp +++ b/media/libstagefright/DataSource.cpp @@ -199,7 +199,18 @@ sp<DataSource> DataSource::CreateFromURI( } else if (!strncasecmp("http://", uri, 7) || !strncasecmp("https://", uri, 8) || isWidevine) { - sp<HTTPBase> httpSource = new MediaHTTP(httpService->makeHTTPConnection()); + if (httpService == NULL) { + ALOGE("Invalid http service!"); + return NULL; + } + + sp<IMediaHTTPConnection> conn = httpService->makeHTTPConnection(); + if (conn == NULL) { + ALOGE("Failed to make http connection from http service!"); + return NULL; + } + + sp<HTTPBase> httpSource = new MediaHTTP(conn); String8 tmp; if (isWidevine) { |