From: Alexis Laferrière Date: Sun, 30 Aug 2015 13:51:31 +0000 (-0400) Subject: lib/re: make `native` a local variable to check it is not null X-Git-Tag: v0.7.8~48^2~2 X-Git-Url: http://nitlanguage.org lib/re: make `native` a local variable to check it is not null Signed-off-by: Alexis Laferrière --- diff --git a/lib/core/re.nit b/lib/core/re.nit index 99421f8..ecf9469 100644 --- a/lib/core/re.nit +++ b/lib/core/re.nit @@ -272,6 +272,9 @@ class Regex private fun get_error(errcode: Int): String do + var native = native + assert native != null + # Error, should be out of memory but we cover any possible error anyway var error_cstr = native.regerror(errcode) @@ -291,6 +294,9 @@ class Regex var comp_res = compile assert comp_res == null else "Regex compilation failed with: {comp_res.message}\n".output + var native = native + assert native != null + # Actually execute var eflags = gather_eflags var res = native.regexec_match_only(text.to_cstring, eflags) @@ -320,6 +326,9 @@ class Regex var comp_res = compile assert comp_res == null else "Regex compilation failed with: {comp_res.message}\n".output + var native = native + assert native != null + # Actually execute text = text.to_s var cstr = text.substring_from(from).to_cstring @@ -353,6 +362,9 @@ class Regex var comp_res = compile assert comp_res == null else "Regex compilation failed with: {comp_res.message}\n".output + var native = native + assert native != null + # Actually execute text = text.to_s var sub = text.substring_from(from) @@ -404,6 +416,9 @@ class Regex var comp_res = compile assert comp_res == null else "Regex compilation failed with: {comp_res.message}\n".output + var native = native + assert native != null + # Actually execute text = text.to_s var cstr = text.to_cstring