diff options
author | Araq <rumpf_a@web.de> | 2013-05-31 01:27:03 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2013-05-31 01:27:03 +0200 |
commit | 8c211113f26260896614b7385b94ed91a5b9f291 (patch) | |
tree | 184835f828a10ec0b177599f55da4e3d39e42ac8 /lib/system | |
parent | a8ba628bcd2535bc55e3bf67737e93ae99906a63 (diff) | |
download | Nim-8c211113f26260896614b7385b94ed91a5b9f291.tar.gz |
better error message for subtle nil errors
Diffstat (limited to 'lib/system')
-rw-r--r-- | lib/system/excpt.nim | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/system/excpt.nim b/lib/system/excpt.nim index faaefe083..bf0fe4b72 100644 --- a/lib/system/excpt.nim +++ b/lib/system/excpt.nim @@ -32,7 +32,7 @@ proc registerSignalHandler() proc chckIndx(i, a, b: int): int {.inline, compilerproc.} proc chckRange(i, a, b: int): int {.inline, compilerproc.} proc chckRangeF(x, a, b: float): float {.inline, compilerproc.} -proc chckNil(p: pointer) {.inline, compilerproc.} +proc chckNil(p: pointer) {.noinline, compilerproc.} var framePtr {.rtlThreadVar.}: PFrame @@ -359,7 +359,9 @@ proc chckRangeF(x, a, b: float): float = raise newException(EOutOfRange, "value " & $x & " out of range") proc chckNil(p: pointer) = - if p == nil: c_raise(SIGSEGV) + if p == nil: + raise newException(EInvalidValue, "attempt to write to a nil address") + #c_raise(SIGSEGV) proc chckObj(obj, subclass: PNimType) {.compilerproc.} = # checks if obj is of type subclass: |