mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-16 20:57:53 +01:00
Prevent zathura from SIGSEGV if link is a NULL pointer
This commit is contained in:
parent
adc9f41264
commit
ef99076a48
1 changed files with 20 additions and 16 deletions
|
@ -195,8 +195,10 @@ zathura_page_widget_set_property(GObject* object, guint prop_id, const GValue* v
|
||||||
|
|
||||||
if (priv->links_got == true && priv->links != NULL) {
|
if (priv->links_got == true && priv->links != NULL) {
|
||||||
GIRARA_LIST_FOREACH(priv->links, zathura_link_t*, iter, link)
|
GIRARA_LIST_FOREACH(priv->links, zathura_link_t*, iter, link)
|
||||||
|
if (link != NULL) {
|
||||||
zathura_rectangle_t rectangle = recalc_rectangle(priv->page, link->position);
|
zathura_rectangle_t rectangle = recalc_rectangle(priv->page, link->position);
|
||||||
redraw_rect(pageview, &rectangle);
|
redraw_rect(pageview, &rectangle);
|
||||||
|
}
|
||||||
GIRARA_LIST_FOREACH_END(priv->links, zathura_link_t*, iter, link);
|
GIRARA_LIST_FOREACH_END(priv->links, zathura_link_t*, iter, link);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -340,6 +342,7 @@ zathura_page_widget_draw(GtkWidget* widget, cairo_t* cairo)
|
||||||
if (priv->draw_links == true && priv->number_of_links != 0) {
|
if (priv->draw_links == true && priv->number_of_links != 0) {
|
||||||
unsigned int link_counter = 0;
|
unsigned int link_counter = 0;
|
||||||
GIRARA_LIST_FOREACH(priv->links, zathura_link_t*, iter, link)
|
GIRARA_LIST_FOREACH(priv->links, zathura_link_t*, iter, link)
|
||||||
|
if (link != NULL) {
|
||||||
zathura_rectangle_t rectangle = recalc_rectangle(priv->page, link->position);
|
zathura_rectangle_t rectangle = recalc_rectangle(priv->page, link->position);
|
||||||
|
|
||||||
/* draw position */
|
/* draw position */
|
||||||
|
@ -356,6 +359,7 @@ zathura_page_widget_draw(GtkWidget* widget, cairo_t* cairo)
|
||||||
char* link_number = g_strdup_printf("%i", priv->link_offset + ++link_counter);
|
char* link_number = g_strdup_printf("%i", priv->link_offset + ++link_counter);
|
||||||
cairo_show_text(cairo, link_number);
|
cairo_show_text(cairo, link_number);
|
||||||
g_free(link_number);
|
g_free(link_number);
|
||||||
|
}
|
||||||
GIRARA_LIST_FOREACH_END(priv->links, zathura_link_t*, iter, link);
|
GIRARA_LIST_FOREACH_END(priv->links, zathura_link_t*, iter, link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue