mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
Add extra nil check for assert and panic
This commit is contained in:
+10
-2
@@ -555,14 +555,22 @@ excl_bit_set :: inline proc(s: ^$S/bit_set[$E; $U], other: S) -> S {
|
|||||||
@(builtin)
|
@(builtin)
|
||||||
assert :: proc "contextless" (condition: bool, message := "", loc := #caller_location) -> bool {
|
assert :: proc "contextless" (condition: bool, message := "", loc := #caller_location) -> bool {
|
||||||
if !condition {
|
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;
|
return condition;
|
||||||
}
|
}
|
||||||
|
|
||||||
@(builtin)
|
@(builtin)
|
||||||
panic :: proc "contextless" (message := "", loc := #caller_location) {
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user