spinner: crash on illegal format set issue fix.

Summary:
Set any illegal format, spinner crashes, the format set to spinner
has to be valid hence a check is added initially itself to check for validity of
label formats.

Signed-off-by: Shilpa Singh <shilpa.singh@samsung.com>

Test Plan:
1. Set illegal format to spinner for e.g: elm_spinner_label_format_set(sp, "d");
2. Run spinner demo
Crash is observed

Reviewers: cedric

Subscribers: govi, buds

Differential Revision: https://phab.enlightenment.org/D3668

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
This commit is contained in:
Shilpa Singh 2016-02-12 21:13:02 +01:00 committed by Cedric BAIL
parent f9f4030433
commit 135802ad1f
1 changed files with 6 additions and 0 deletions

View File

@ -1348,6 +1348,12 @@ _elm_spinner_eo_base_constructor(Eo *obj, Elm_Spinner_Data *_pd EINA_UNUSED)
EOLIAN static void
_elm_spinner_label_format_set(Eo *obj, Elm_Spinner_Data *sd, const char *fmt)
{
if (!strchr(fmt, '%'))
{
WRN("Warning: %s is an Illegal format, cannot be set", fmt);
return;
}
eina_stringshare_replace(&sd->label, fmt);
if (fmt && !(_is_label_format_integer(sd->label)))