diff options
| author | gingerBill <bill@gingerbill.org> | 2018-08-30 11:16:06 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2018-08-30 11:16:06 +0100 |
| commit | dda985f49df2ad037019584c6086095433a5b7bc (patch) | |
| tree | b817cd9fd7d1a722c298a9cf89fb9e4f45e4fa14 /core/runtime | |
| parent | 12256beeb25ad33880cef5a8a808a40d80fa3c10 (diff) | |
Add extra nil check for `assert` and `panic`
Diffstat (limited to 'core/runtime')
| -rw-r--r-- | core/runtime/core.odin | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/core/runtime/core.odin b/core/runtime/core.odin index 6c22cf2cf..cf00a34a6 100644 --- a/core/runtime/core.odin +++ b/core/runtime/core.odin @@ -555,14 +555,22 @@ excl_bit_set :: inline proc(s: ^$S/bit_set[$E; $U], other: S) -> S { @(builtin) assert :: proc "contextless" (condition: bool, message := "", loc := #caller_location) -> bool { if !condition { - context.assertion_failure_proc("Runtime assertion", message, loc); + p := context.assertion_failure_proc; + if p == nil { + p = default_assertion_failure_proc; + } + p("Runtime assertion", message, loc); } return condition; } @(builtin) panic :: proc "contextless" (message := "", loc := #caller_location) { - context.assertion_failure_proc("Panic", message, loc); + p := context.assertion_failure_proc; + if p == nil { + p = default_assertion_failure_proc; + } + p("Panic", message, loc); } |