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

Commit 37d8b27e authored by Chong Zhang's avatar Chong Zhang
Browse files

MediaHTTP: add more null ptr and init checks

bug: 20912192
Change-Id: I83cf59ff85fd8aa3a19a696ceb97cd8aa922b8ba
parent 32fa6d0e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ struct BpMediaHTTPService : public BpInterface<IMediaHTTPService> {
        status_t err = reply.readInt32();

        if (err != OK) {
            ALOGE("Unable to make HTTP connection (err = %d)", err);
            return NULL;
        }

+5 −2
Original line number Diff line number Diff line
@@ -30,12 +30,11 @@
namespace android {

MediaHTTP::MediaHTTP(const sp<IMediaHTTPConnection> &conn)
    : mInitCheck(NO_INIT),
    : mInitCheck((conn != NULL) ? OK : NO_INIT),
      mHTTPConnection(conn),
      mCachedSizeValid(false),
      mCachedSize(0ll),
      mDrmManagerClient(NULL) {
    mInitCheck = OK;
}

MediaHTTP::~MediaHTTP() {
@@ -171,6 +170,10 @@ void MediaHTTP::getDrmInfo(
}

String8 MediaHTTP::getUri() {
    if (mInitCheck != OK) {
        return String8::empty();
    }

    String8 uri;
    if (OK == mHTTPConnection->getUri(&uri)) {
        return uri;