From 0d9adb930a1807f9f869a65687b5ab003cd7b185 Mon Sep 17 00:00:00 2001 From: Inkyun Kil Date: Fri, 12 Jun 2020 15:16:09 +0900 Subject: [PATCH] Revise ambient_viewer_notify_ambient_event The 'extra' parameter can be NULL. Therefore, the ambient_viewer_notify_ambient_event should be able to pass an empty bundle. Change-Id: I18be28d5a4d0dc5ffb8de97cc0a998b198ebfb0b Signed-off-by: Inkyun Kil --- ambient-viewer/src/stub.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ambient-viewer/src/stub.cc b/ambient-viewer/src/stub.cc index 875cc85..550b1fc 100644 --- a/ambient-viewer/src/stub.cc +++ b/ambient-viewer/src/stub.cc @@ -181,14 +181,18 @@ extern "C" EXPORT_API int ambient_viewer_destroy(ambient_viewer_h handle) { extern "C" EXPORT_API int ambient_viewer_notify_ambient_event( ambient_viewer_h handle, ambient_viewer_state_e state, ambient_viewer_direction_e dir, bundle *extra) { - if (handle == nullptr || extra == nullptr) { + if (handle == nullptr) { LOGE("Invalid parameter"); return AMBIENT_VIEWER_ERROR_INVALID_PARAMETER; } + Bundle bundle; + if (extra) + bundle = Bundle(extra, false, false); + AmbientViewerStub* stub = static_cast(handle); stub->NotifyAmbientEvent((AmbientViewer::AmbientState)state, - static_cast(dir), Bundle(extra, false, false)); + static_cast(dir), std::move(bundle)); return AMBIENT_VIEWER_ERROR_NONE; } -- 2.7.4