From ab6e83ad4185e9623947dc82e4176c84eb05716a Mon Sep 17 00:00:00 2001 From: Flaviu Tamas Date: Wed, 4 Mar 2015 19:29:35 -0500 Subject: [PATCH] Fix tests broken in 7296c6d 7296c6d doesn't do any nil checking, so it segfaults on `==` on `Regex` --- src/nre.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nre.nim b/src/nre.nim index 421b6a2828..dd00cf8225 100644 --- a/src/nre.nim +++ b/src/nre.nim @@ -175,7 +175,8 @@ proc `$`*(pattern: RegexMatch): string = proc `==`*(a, b: Regex): bool = # name-to-number table is generated at init time, doesn't need to be checked - return a.pattern == b.pattern and + return not a.isNil and not b.isNil and + a.pattern == b.pattern and a.pcreObj == b.pcreObj and a.pcreExtra == b.pcreExtra