Fix exception if no text is found to append
Merge pull request #12134 from cachedout/12131

Fix exception if no text is found to append