With this workflow post-function, you can ensure that issue has or not subtasks before to execute this transicion.
Add
validator
.Has SubTasks Validator
from the list of validators.Add
to add the validator on the transition.Error Message – Set here the message you want to display o users when this validation fails