(ParticleSystem) Fix crash issue when particle create failed 85/322385/2
authorEunki, Hong <eunkiki.hong@samsung.com>
Tue, 8 Apr 2025 08:36:11 +0000 (17:36 +0900)
committerEunki Hong <eunkiki.hong@samsung.com>
Wed, 9 Apr 2025 06:14:23 +0000 (06:14 +0000)
It is possible that particle handle is empty.

In this case, we should not call GetImplement()

Change-Id: I709708a231fe4856b026b8085ffd0e76300a0f27
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
dali-csharp-binder/dali-toolkit/particle-system-wrap.cpp

index 9c6e9be88c9f4e9d6f0796947cf3b31c584907e9..36782dd5a719d96e1e5abf910cff3aa8a246ce36 100644 (file)
@@ -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)