Fix null derefs on RCons when no context is provided ##cons

This commit is contained in:
pancake 2020-05-02 11:36:27 +02:00 committed by pancake
parent 2fe490c4cd
commit 4ae1527bd2

View File

@ -306,7 +306,7 @@ R_API void r_cons_break_clear(void) {
}
R_API void r_cons_context_break_push(RConsContext *context, RConsBreak cb, void *user, bool sig) {
if (!context->break_stack) {
if (!context || !context->break_stack) {
return;
}
@ -333,7 +333,7 @@ R_API void r_cons_context_break_push(RConsContext *context, RConsBreak cb, void
}
R_API void r_cons_context_break_pop(RConsContext *context, bool sig) {
if (!context->break_stack) {
if (!context || !context->break_stack) {
return;
}
//restore old state
@ -381,7 +381,7 @@ R_API bool r_cons_is_breaked(void) {
I.timeout = 0;
}
}
return I.context->breaked;
return I.context && I.context->breaked;
}
R_API void r_cons_line(int x, int y, int x2, int y2, int ch) {