externalscript: don't attempt to open an empty-URL document
I have verified that the external script Sort Selection now works correctly in the scenario described in the added comment.
I have verified that the external script Sort Selection now works correctly in the scenario described in the added comment.