# Abort task when stop playing crashes editor

**URL:** <https://forums.unrealengine.com/t/abort-task-when-stop-playing-crashes-editor/327192>\
**Category:** Platform & Builds\
**Tags:** task, unreal-engine, question\
**Created:** [July 31, 2015, 3:20pm UTC](https://forums.unrealengine.com/t/abort-task-when-stop-playing-crashes-editor/327192 "2015-07-31T15:20:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nach](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nach](https://forums.unrealengine.com/u/Nach)\
**Post date:** [July 31, 2015, 3:20pm UTC](https://forums.unrealengine.com/t/abort-task-when-stop-playing-crashes-editor/327192/1 "2015-07-31T15:20:07Z")

</div>

So here’s my problem.  
My AI is casting some attack ( running a specific task). In my Task I handle abort event, as it finishes aborting only if the cast is over (I just check if the State “castingAttack” of my AICharacter is not active).  
If I stop playing while the AI was casting an attack, the editor crashes, saying that I try to access to a nullptr. which is the AICharacter. What I understand, is that the cast attack cast receive the abort event when I stop playing, but the AICharacter was already destroy.  
How can I handle this problem, without checking if the AICharacter is valid on every Task?

---

<div class="post-metadata">

**Author:** ![ThatAwesomeJude](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ThatAwesomeJude](https://forums.unrealengine.com/u/ThatAwesomeJude)\
**Post date:** [October 18, 2022, 3:19am UTC](https://forums.unrealengine.com/t/abort-task-when-stop-playing-crashes-editor/327192/2 "2022-10-18T03:19:31Z")

</div>

bump.
