hwc: Fix null dereference

Fix possible null dereference in hwc.

Change-Id: Ib403d4b742cc52175b93268c023ba273377e7b91
This commit is contained in:
Charles Bin
2014-06-30 10:34:30 -07:00
parent 444a423021
commit dab393806c

View File

@@ -259,9 +259,15 @@ void initContext(hwc_context_t *ctx)
//independent process as well.
QService::init();
sp<IQClient> client = new QClient(ctx);
interface_cast<IQService>(
android::sp<qService::IQService> qservice_sp = interface_cast<IQService>(
defaultServiceManager()->getService(
String16("display.qservice")))->connect(client);
String16("display.qservice")));
if (qservice_sp.get()) {
qservice_sp->connect(client);
} else {
ALOGE("%s: Failed to acquire service pointer", __FUNCTION__);
return ;
}
// Initialize device orientation to its default orientation
ctx->deviceOrientation = 0;