Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 217bde88 authored by Chong Zhang's avatar Chong Zhang
Browse files

fix crash when makeHTTPConnection fails with null pointer

Bug: 17608108
Change-Id: I4bdf6d09ae565418be3d6677b5ccac9072fb9b2c
parent 2973994a
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -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) {