On Sat, Oct 6, 2012 at 4:11 AM, Bram Moolenaar <[email protected]> wrote:
>
> Yukihiro Nakadaira wrote:
>
>> Vim crashes with SEGV when executing :py vim.bindeval("matchstr('', 'x')").
>> And vim.eval("matchstr('', 'x')") returns None.
>>
>> The following patch fix this problem.
>> Please check it.
>
> Thanks, I'll include it. I suppose we should also check for VAR_FUNC.
Thank you for including it.
Additionally if_mzsch.c and if_lua.c have same code.
Please check and include this.
I didn't do test for if_mzsch.c.
diff -r aa51675adf7e src/if_lua.c
--- a/src/if_lua.c Fri Oct 05 22:26:30 2012 +0200
+++ b/src/if_lua.c Thu Oct 11 23:26:25 2012 +0900
@@ -464,7 +464,8 @@
switch (tv->v_type)
{
case VAR_STRING:
- lua_pushstring(L, (char *) tv->vval.v_string);
+ lua_pushstring(L, tv->vval.v_string == NULL
+ ? "" : (char *)tv->vval.v_string);
break;
case VAR_NUMBER:
lua_pushinteger(L, (int) tv->vval.v_number);
diff -r aa51675adf7e src/if_mzsch.c
--- a/src/if_mzsch.c Fri Oct 05 22:26:30 2012 +0200
+++ b/src/if_mzsch.c Thu Oct 11 23:26:25 2012 +0900
@@ -2649,7 +2649,8 @@
new_value = FALSE;
else if (vim_value->v_type == VAR_STRING)
{
- result = scheme_make_string((char *)vim_value->vval.v_string);
+ result = scheme_make_string(vim_value->vval.v_string == NULL
+ ? "" : (char *)vim_value->vval.v_string);
MZ_GC_CHECK();
}
else if (vim_value->v_type == VAR_NUMBER)
--
Yukihiro Nakadaira - [email protected]
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php