summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2016-08-01 14:41:08 -0700
committerJohn Reck <jreck@google.com>2016-08-01 14:52:25 -0700
commit882d515cd54627f320269aa2d744f1c9f1a75c71 (patch)
treee152f732fad7c83aab9b7b4176aee8b41ba1a5f2 /libs
parentfbd93027e4f8024642271652e490653a4d0c2b55 (diff)
downloadandroid-frameworks-base-882d515cd54627f320269aa2d744f1c9f1a75c71.tar.gz
android-frameworks-base-882d515cd54627f320269aa2d744f1c9f1a75c71.tar.xz
Fix null deref crash
Bug: 30560152 Change-Id: Ic4bae380e27de5bea80cec484e83d205e078ec43
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/renderthread/CanvasContext.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index d68f0e3..c6b258b 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -562,11 +562,16 @@ void CanvasContext::draw() {
swap.damage = screenDirty;
swap.swapCompletedTime = systemTime(CLOCK_MONOTONIC);
swap.vsyncTime = mRenderThread.timeLord().latestVsync();
- int durationUs;
- mNativeSurface->query(NATIVE_WINDOW_LAST_DEQUEUE_DURATION, &durationUs);
- swap.dequeueDuration = us2ns(durationUs);
- mNativeSurface->query(NATIVE_WINDOW_LAST_QUEUE_DURATION, &durationUs);
- swap.queueDuration = us2ns(durationUs);
+ if (mNativeSurface.get()) {
+ int durationUs;
+ mNativeSurface->query(NATIVE_WINDOW_LAST_DEQUEUE_DURATION, &durationUs);
+ swap.dequeueDuration = us2ns(durationUs);
+ mNativeSurface->query(NATIVE_WINDOW_LAST_QUEUE_DURATION, &durationUs);
+ swap.queueDuration = us2ns(durationUs);
+ } else {
+ swap.dequeueDuration = 0;
+ swap.queueDuration = 0;
+ }
mCurrentFrameInfo->set(FrameInfoIndex::DequeueBufferDuration)
= swap.dequeueDuration;
mCurrentFrameInfo->set(FrameInfoIndex::QueueBufferDuration)