jaehyun pushed a commit to branch master.

http://git.enlightenment.org/tools/enventor.git/commit/?id=cab91580fe7f433e2f557013ba32e280e76fb928

commit cab91580fe7f433e2f557013ba32e280e76fb928
Author: Jaehyun Cho <jae_hyun....@samsung.com>
Date:   Mon Mar 7 19:41:21 2016 +0900

    config_data: Terminate if config init is failed.
    
    If config init is failed, then initialization is stopped and terminated.
    
    @fix
---
 src/bin/config_data.c     |  5 ++++-
 src/bin/main.c            | 10 +++++++---
 src/include/config_data.h |  2 +-
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/bin/config_data.c b/src/bin/config_data.c
index 08586c3..810a5de 100644
--- a/src/bin/config_data.c
+++ b/src/bin/config_data.c
@@ -311,7 +311,7 @@ config_input_path_set(const char *input_path)
    config_edj_path_update(cd);
 }
 
-void
+Eina_Bool
 config_init(const char *input_path, const char *output_path,
             Eina_List *img_path, Eina_List *snd_path,
             Eina_List *fnt_path, Eina_List *dat_path)
@@ -319,6 +319,7 @@ config_init(const char *input_path, const char *output_path,
    eddc_init();
 
    config_data *cd = config_load();
+   if (!cd) return EINA_FALSE;
    g_cd = cd;
 
    if (input_path[0]) config_input_path_set(input_path);
@@ -335,6 +336,8 @@ config_init(const char *input_path, const char *output_path,
 
    if (dat_path)
      g_cd->dat_path_list = dat_path;
+
+   return EINA_TRUE;
 }
 
 void
diff --git a/src/bin/main.c b/src/bin/main.c
index 64f70b3..7f76b24 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -340,7 +340,7 @@ defaults:
    ecore_getopt_list_free(dd);
 }
 
-static void
+static Eina_Bool
 config_data_set(app_data *ad, int argc, char **argv, Eina_Bool *default_edc,
                 Eina_Bool *template)
 {
@@ -353,8 +353,11 @@ config_data_set(app_data *ad, int argc, char **argv, 
Eina_Bool *default_edc,
 
    args_dispatch(argc, argv, edc_path, edj_path, &img_path, &snd_path,
                  &fnt_path, &dat_path, default_edc, template);
-   config_init(edc_path, edj_path, img_path, snd_path, fnt_path, dat_path);
+   if (!config_init(edc_path, edj_path, img_path, snd_path, fnt_path, 
dat_path))
+     return EINA_FALSE;
    config_update_cb_set(config_update_cb, ad);
+
+   return EINA_TRUE;
 }
 
 static void
@@ -900,7 +903,8 @@ init(app_data *ad, int argc, char **argv)
 
    Eina_Bool template = EINA_FALSE;
    Eina_Bool default_edc = EINA_TRUE;
-   config_data_set(ad, argc, argv, &default_edc, &template);
+   if (!config_data_set(ad, argc, argv, &default_edc, &template))
+     return EINA_FALSE;
    newfile_default_set(default_edc);
    base_gui_init();
    statusbar_set();
diff --git a/src/include/config_data.h b/src/include/config_data.h
index 0b2c06d..7fbbce5 100644
--- a/src/include/config_data.h
+++ b/src/include/config_data.h
@@ -3,7 +3,7 @@
 #define MAX_VIEW_SCALE 5.0
 #define MIN_VIEW_SCALE 0.1
 
-void config_init(const char *input_path, const char *output_path, Eina_List 
*img_path, Eina_List *snd_path, Eina_List *fnt_path, Eina_List *dat_path);
+Eina_Bool config_init(const char *input_path, const char *output_path, 
Eina_List *img_path, Eina_List *snd_path, Eina_List *fnt_path, Eina_List 
*dat_path);
 void config_term(void);
 const char *config_input_path_get(void);
 const char *config_output_path_get(void);

-- 


Reply via email to