From d1a5a7b5699c5533bc89b31a2c281334acf574f4 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Thu, 5 Feb 2009 10:27:43 -0500 Subject: Handle an empty clipboard properly; src/lua_interface.c --- src/lua_interface.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/lua_interface.c b/src/lua_interface.c index 443c7a9d..677e9709 100644 --- a/src/lua_interface.c +++ b/src/lua_interface.c @@ -1203,8 +1203,10 @@ static int l_ta_mt_index(lua_State *lua) { else if (streq(key, "clipboard_text")) { char *text = gtk_clipboard_wait_for_text(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD)); - if (text) lua_pushstring(lua, text); - g_free(text); + if (text) { + lua_pushstring(lua, text); + g_free(text); + } else lua_pushstring(lua, ""); } else if (streq(key, "size")) { lua_newtable(lua); int width, height; -- cgit v1.2.3