From a6dfef09c653469b90d6e6d7e79a1cb7b6e6da11 Mon Sep 17 00:00:00 2001 From: "Eunki, Hong" Date: Tue, 8 Apr 2025 17:36:11 +0900 Subject: [PATCH] (ParticleSystem) Fix crash issue when particle create failed It is possible that particle handle is empty. In this case, we should not call GetImplement() Change-Id: I709708a231fe4856b026b8085ffd0e76300a0f27 Signed-off-by: Eunki, Hong --- dali-csharp-binder/dali-toolkit/particle-system-wrap.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dali-csharp-binder/dali-toolkit/particle-system-wrap.cpp b/dali-csharp-binder/dali-toolkit/particle-system-wrap.cpp index 9c6e9be8..36782dd5 100644 --- a/dali-csharp-binder/dali-toolkit/particle-system-wrap.cpp +++ b/dali-csharp-binder/dali-toolkit/particle-system-wrap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * Copyright (c) 2025 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -579,10 +579,14 @@ SWIGEXPORT int SWIGSTDCALL CSharp_Dali_ParticleEmitter_NewParticle(void* csEmitt try { Particle p = emitter->GetParticleList().NewParticle(lifetime); - return int(p.GetIndex()); + if(p) + { + return p.GetIndex(); + } } CALL_CATCH_EXCEPTION(-1); } + return -1; } SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_ParticleEmitter_GetParticleList(void* csThis) -- 2.34.1