summaryrefslogtreecommitdiff
path: root/sdm/libs/hwc2/hwc_buffer_allocator.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sdm/libs/hwc2/hwc_buffer_allocator.cpp')
-rw-r--r--sdm/libs/hwc2/hwc_buffer_allocator.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/sdm/libs/hwc2/hwc_buffer_allocator.cpp b/sdm/libs/hwc2/hwc_buffer_allocator.cpp
index a1b763ca..0e05ca9d 100644
--- a/sdm/libs/hwc2/hwc_buffer_allocator.cpp
+++ b/sdm/libs/hwc2/hwc_buffer_allocator.cpp
@@ -48,12 +48,14 @@ HWCBufferAllocator::HWCBufferAllocator() {
} else {
gralloc1_open(module_, &gralloc_device_);
}
- ReleaseBuffer_ = reinterpret_cast<GRALLOC1_PFN_RELEASE>(
- gralloc_device_->getFunction(gralloc_device_, GRALLOC1_FUNCTION_RELEASE));
- Perform_ = reinterpret_cast<GRALLOC1_PFN_PERFORM>(
- gralloc_device_->getFunction(gralloc_device_, GRALLOC1_FUNCTION_PERFORM));
- Lock_ = reinterpret_cast<GRALLOC1_PFN_LOCK>(
- gralloc_device_->getFunction(gralloc_device_, GRALLOC1_FUNCTION_LOCK));
+ if (gralloc_device_ != nullptr) {
+ ReleaseBuffer_ = reinterpret_cast<GRALLOC1_PFN_RELEASE>(
+ gralloc_device_->getFunction(gralloc_device_, GRALLOC1_FUNCTION_RELEASE));
+ Perform_ = reinterpret_cast<GRALLOC1_PFN_PERFORM>(
+ gralloc_device_->getFunction(gralloc_device_, GRALLOC1_FUNCTION_PERFORM));
+ Lock_ = reinterpret_cast<GRALLOC1_PFN_LOCK>(
+ gralloc_device_->getFunction(gralloc_device_, GRALLOC1_FUNCTION_LOCK));
+ }
}
HWCBufferAllocator::~HWCBufferAllocator() {