(A11y) Let we make some way to do not create new Accessible
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / text-controls / text-editor-impl.cpp
index 3fc19f2..a9d5c2b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -969,17 +969,29 @@ void TextEditor::RequestTextRelayout()
 
 void TextEditor::TextInserted(unsigned int position, unsigned int length, const std::string& content)
 {
-  GetAccessibleObject()->EmitTextInserted(position, length, content);
+  auto accessible = GetAccessibleObject();
+  if(DALI_LIKELY(accessible))
+  {
+    accessible->EmitTextInserted(position, length, content);
+  }
 }
 
 void TextEditor::TextDeleted(unsigned int position, unsigned int length, const std::string& content)
 {
-  GetAccessibleObject()->EmitTextDeleted(position, length, content);
+  auto accessible = GetAccessibleObject();
+  if(DALI_LIKELY(accessible))
+  {
+    accessible->EmitTextDeleted(position, length, content);
+  }
 }
 
 void TextEditor::CursorPositionChanged(unsigned int oldPosition, unsigned int newPosition)
 {
-  GetAccessibleObject()->EmitTextCursorMoved(newPosition);
+  auto accessible = GetAccessibleObject();
+  if(DALI_LIKELY(accessible))
+  {
+    accessible->EmitTextCursorMoved(newPosition);
+  }
 
   if((oldPosition != newPosition) && !mCursorPositionChanged)
   {