barbieri pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=f42e6494760a63ad4215e486d460d33cf2c58a7b

commit f42e6494760a63ad4215e486d460d33cf2c58a7b
Author: Gustavo Sverzut Barbieri <barbi...@profusion.mobi>
Date:   Mon Sep 19 01:16:37 2016 -0300

    efl_promise: check NULL before calling.
    
    we do not check any of success, failure or progress, so we must check
    if they are valid before calling.
    
    This fixed a bug in efl_net_dialer_tcp where it uses a null failure
    cb and was SEGV.
---
 src/lib/ecore/efl_promise.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/lib/ecore/efl_promise.c b/src/lib/ecore/efl_promise.c
index 09a2166..bd933fc 100644
--- a/src/lib/ecore/efl_promise.c
+++ b/src/lib/ecore/efl_promise.c
@@ -98,13 +98,13 @@ _efl_loop_future_success(Efl_Event *ev, 
Efl_Loop_Future_Data *pd, void *value)
           {
              chain_success.next = cb->next;
 
-             cb->success((void*) cb->data, ev);
+             if (cb->success) cb->success((void*) cb->data, ev);
           }
         else
           {
              chain_success.next = NULL;
              chain_success.value = pd->message;
-             cb->success((void*) cb->data, ev);
+             if (cb->success) cb->success((void*) cb->data, ev);
              chain_success.value = value;
           }
 
@@ -128,7 +128,7 @@ _efl_loop_future_failure(Efl_Event *ev, 
Efl_Loop_Future_Data *pd, Eina_Error err
      {
         chain_fail.next = cb->next;
 
-        cb->failure((void*) cb->data, ev);
+        if (cb->failure) cb->failure((void*) cb->data, ev);
 
         pd->callbacks = eina_inlist_remove(pd->callbacks, pd->callbacks);
         free(cb);
@@ -600,7 +600,7 @@ _efl_promise_progress_set(Eo *obj, Efl_Promise_Data *pd, 
const void *p)
                {
                   chain_progress.next = cb->next;
 
-                  cb->progress((void*) cb->data, &ev);
+                  if (cb->progress) cb->progress((void*) cb->data, &ev);
                }
           }
      }

-- 


Reply via email to