From 3797ae30ccbf7cd80835b65cbc97ad7d9d5468ff Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Mon, 5 Sep 2016 18:22:20 -0400 Subject: Better error handling in filter-through; modules/textadept/editing.lua --- modules/textadept/editing.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modules') 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 -- cgit v1.2.3