Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Bugfix: protect SIMIX_context_self() in the case that SIMIX is not initialized.
authorcristianrosa <cristianrosa@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 6 Dec 2010 14:54:14 +0000 (14:54 +0000)
committercristianrosa <cristianrosa@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 6 Dec 2010 14:54:14 +0000 (14:54 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9018 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/simix/private.h

index 9095077..e3fc539 100644 (file)
@@ -238,11 +238,11 @@ static XBT_INLINE void SIMIX_context_runall(xbt_swag_t processes)
  */
 static XBT_INLINE smx_context_t SIMIX_context_self(void)
 {
  */
 static XBT_INLINE smx_context_t SIMIX_context_self(void)
 {
-  if (simix_global->context_factory == NULL) {
-    return NULL;
+  if (simix_global && simix_global->context_factory != NULL) {
+    return (*(simix_global->context_factory->self))();
   }
 
   }
 
-  return (*(simix_global->context_factory->self))();
+  return NULL;
 }
 
 /**
 }
 
 /**