Skip to content

Commit

Permalink
Fix other instances of same null deref pattern with y_offset
Browse files Browse the repository at this point in the history
  • Loading branch information
mtijanic committed Nov 3, 2023
1 parent c6d5ca1 commit b0ec2cb
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions nuklear.h
Original file line number Diff line number Diff line change
Expand Up @@ -22877,7 +22877,15 @@ nk_group_get_scroll(struct nk_context *ctx, const char *id, nk_uint *x_offset, n
NK_ASSERT(y_offset_ptr);
if (!x_offset_ptr || !y_offset_ptr) return;
*x_offset_ptr = *y_offset_ptr = 0;
} else y_offset_ptr = nk_find_value(win, id_hash+1);
} else {
y_offset_ptr = nk_find_value(win, id_hash+1);
if (!y_offset_ptr) {
y_offset_ptr = nk_add_value(ctx, win, id_hash+1, 0);
NK_ASSERT(y_offset_ptr);
if (!y_offset_ptr) return;
*y_offset_ptr = 0;
}
}
if (x_offset)
*x_offset = *x_offset_ptr;
if (y_offset)
Expand Down Expand Up @@ -22912,7 +22920,15 @@ nk_group_set_scroll(struct nk_context *ctx, const char *id, nk_uint x_offset, nk
NK_ASSERT(y_offset_ptr);
if (!x_offset_ptr || !y_offset_ptr) return;
*x_offset_ptr = *y_offset_ptr = 0;
} else y_offset_ptr = nk_find_value(win, id_hash+1);
} else {
y_offset_ptr = nk_find_value(win, id_hash+1);
if (!y_offset_ptr) {
y_offset_ptr = nk_add_value(ctx, win, id_hash+1, 0);
NK_ASSERT(y_offset_ptr);
if (!y_offset_ptr) return;
*y_offset_ptr = 0;
}
}
*x_offset_ptr = x_offset;
*y_offset_ptr = y_offset;
}
Expand Down Expand Up @@ -22962,7 +22978,15 @@ nk_list_view_begin(struct nk_context *ctx, struct nk_list_view *view,
NK_ASSERT(y_offset);
if (!x_offset || !y_offset) return 0;
*x_offset = *y_offset = 0;
} else y_offset = nk_find_value(win, title_hash+1);
} else {
y_offset = nk_find_value(win, title_hash+1);
if (!y_offset) {
y_offset = nk_add_value(ctx, win, title_hash+1, 0);
NK_ASSERT(y_offset);
if (!y_offset) return 0;
*y_offset = 0;
}
}
view->scroll_value = *y_offset;
view->scroll_pointer = y_offset;

Expand Down

0 comments on commit b0ec2cb

Please sign in to comment.