aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept/editing.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2016-09-05 18:22:20 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2016-09-05 18:22:20 -0400
commit3797ae30ccbf7cd80835b65cbc97ad7d9d5468ff (patch)
tree45d6286c2dfba5ee62037b2ac64a64db49e54e61 /modules/textadept/editing.lua
parentee754a5cbdbe965658eb8a127d9c71aaf800d267 (diff)
downloadtextadept-3797ae30ccbf7cd80835b65cbc97ad7d9d5468ff.tar.gz
textadept-3797ae30ccbf7cd80835b65cbc97ad7d9d5468ff.zip
Better error handling in filter-through; modules/textadept/editing.lua
Diffstat (limited to 'modules/textadept/editing.lua')
-rw-r--r--modules/textadept/editing.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua
index 238db220..3224a560 100644
--- a/modules/textadept/editing.lua
+++ b/modules/textadept/editing.lua
@@ -515,10 +515,10 @@ function M.filter_through(command)
-- Use the whole buffer as input.
buffer:target_whole_document()
end
- local p = spawn(command)
+ local p = assert(spawn(command))
p:write(buffer.target_text)
p:close()
- buffer:replace_target(p:read('*a'):iconv('UTF-8', _CHARSET))
+ buffer:replace_target((p:read('*a') or ''):iconv('UTF-8', _CHARSET))
if s ~= e then
buffer:set_sel(buffer.target_start, buffer.target_end)
else