forked from enlightenment/efl
evas textblock: remove NULL checking after dereferencing
Summary: c->paragraphs couldn't be NULL if it is created by _layout_paragraph_new() well. So, NULL checking should be moved to after _layout_paragraph_new(). Test Plan: N/A Reviewers: jpeg, tasn, raster, herdsman, cedric Subscribers: zmike, stefan_schmidt, jpeg Tags: #efl Differential Revision: https://phab.enlightenment.org/D4300
This commit is contained in:
parent
73c39bcf12
commit
fa8aa7c9c8
|
@ -3152,13 +3152,18 @@ _layout_find_paragraph_by_line_no(Efl_Canvas_Text_Data *o, int line_no)
|
|||
* @param c The context to work on - Not NULL.
|
||||
* @param n the associated text node
|
||||
* @param append true to append, false to prpend.
|
||||
* @return @c EINA_TRUE on success, @c EINA_FALSE otherwise.
|
||||
*/
|
||||
static void
|
||||
static Eina_Bool
|
||||
_layout_paragraph_new(Ctxt *c, Evas_Object_Textblock_Node_Text *n,
|
||||
Eina_Bool append)
|
||||
{
|
||||
Evas_Object_Textblock_Paragraph *rel_par = c->par;
|
||||
c->par = calloc(1, sizeof(Evas_Object_Textblock_Paragraph));
|
||||
Evas_Object_Textblock_Paragraph *new_par = calloc(1, sizeof(Evas_Object_Textblock_Paragraph));
|
||||
|
||||
if (!new_par) return EINA_FALSE;
|
||||
c->par = new_par;
|
||||
|
||||
if (append || !rel_par)
|
||||
c->paragraphs = (Evas_Object_Textblock_Paragraph *)
|
||||
eina_inlist_append_relative(EINA_INLIST_GET(c->paragraphs),
|
||||
|
@ -3177,6 +3182,8 @@ _layout_paragraph_new(Ctxt *c, Evas_Object_Textblock_Node_Text *n,
|
|||
c->par->line_no = -1;
|
||||
c->par->visible = 1;
|
||||
c->o->num_paragraphs++;
|
||||
|
||||
return EINA_TRUE;
|
||||
}
|
||||
|
||||
#ifdef BIDI_SUPPORT
|
||||
|
@ -6323,7 +6330,8 @@ _layout_pre(Ctxt *c)
|
|||
else
|
||||
{
|
||||
/* If it's a new paragraph, just add it. */
|
||||
_layout_paragraph_new(c, n, EINA_FALSE);
|
||||
if (!_layout_paragraph_new(c, n, EINA_FALSE))
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef BIDI_SUPPORT
|
||||
|
@ -6428,7 +6436,7 @@ _layout_pre(Ctxt *c)
|
|||
* if the last paragraph has no lines/text, create that as well */
|
||||
if (!c->paragraphs)
|
||||
{
|
||||
_layout_paragraph_new(c, NULL, EINA_TRUE);
|
||||
if (!_layout_paragraph_new(c, NULL, EINA_TRUE)) return;
|
||||
o->paragraphs = c->paragraphs;
|
||||
}
|
||||
c->par = (Evas_Object_Textblock_Paragraph *)
|
||||
|
@ -6551,7 +6559,7 @@ _layout_visual(Ctxt *c)
|
|||
}
|
||||
|
||||
/* Get the last visible paragraph in the layout */
|
||||
if (!last_vis_par && c->paragraphs)
|
||||
if (!last_vis_par)
|
||||
last_vis_par = (Evas_Object_Textblock_Paragraph *)
|
||||
EINA_INLIST_GET(c->paragraphs)->last;
|
||||
|
||||
|
|
Loading…
Reference in New Issue