Merge "Check for null buffer when calling Transaction#setBuffer" into tm-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
4c850d741b
@@ -688,8 +688,11 @@ static void nativeSetBuffer(JNIEnv* env, jclass clazz, jlong transactionObj, jlo
|
|||||||
jobject bufferObject, jlong fencePtr, jobject releaseCallback) {
|
jobject bufferObject, jlong fencePtr, jobject releaseCallback) {
|
||||||
auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj);
|
auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj);
|
||||||
SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl*>(nativeObject);
|
SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl*>(nativeObject);
|
||||||
sp<GraphicBuffer> graphicBuffer(GraphicBuffer::fromAHardwareBuffer(
|
sp<GraphicBuffer> graphicBuffer;
|
||||||
android_hardware_HardwareBuffer_getNativeHardwareBuffer(env, bufferObject)));
|
if (bufferObject != nullptr) {
|
||||||
|
graphicBuffer = GraphicBuffer::fromAHardwareBuffer(
|
||||||
|
android_hardware_HardwareBuffer_getNativeHardwareBuffer(env, bufferObject));
|
||||||
|
}
|
||||||
std::optional<sp<Fence>> optFence = std::nullopt;
|
std::optional<sp<Fence>> optFence = std::nullopt;
|
||||||
if (fencePtr != 0) {
|
if (fencePtr != 0) {
|
||||||
optFence = sp<Fence>{reinterpret_cast<Fence*>(fencePtr)};
|
optFence = sp<Fence>{reinterpret_cast<Fence*>(fencePtr)};
|
||||||
|
|||||||
Reference in New Issue
Block a user