Added protections to RenderScript VTS class teardown.
If RenderScript HIDL server does not exist or cannot be opened,
currently it results in a nullptr dereference when the VTS test is
torn down. This CL adds a check before the cleanup.
Test: mm -j40
Bug: 63711002
Change-Id: I11a226a78b31444e7b198b2ff1dfa3794963caa0
diff --git a/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp b/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp
index 2670b8d..c6eecd6 100644
--- a/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp
+++ b/renderscript/1.0/vts/functional/VtsHalRenderscriptV1_0TargetTest.cpp
@@ -28,8 +28,10 @@
}
void RenderscriptHidlTest::TearDown() {
- context->contextFinish();
- context->contextDestroy();
+ if (context.get() != nullptr) {
+ context->contextFinish();
+ context->contextDestroy();
+ }
}
// A class for test environment setup (kept since this file is a template).