compiler/ecere: Proper fix.
authorJerome St-Louis <jerome@ecere.com>
Sun, 17 Mar 2013 08:16:30 +0000 (04:16 -0400)
committerJerome St-Louis <jerome@ecere.com>
Sun, 17 Mar 2013 08:16:30 +0000 (04:16 -0400)
compiler/bootstrap/ecere/bootstrap/instance.c
ecere/src/com/instance.ec

index fae4f38..051f60d 100644 (file)
@@ -3508,7 +3508,9 @@ if(_class)
 {
 {
 int size = _class->structSize;
-int flags = (unsigned int)((struct __ecereNameSpace__ecere__com__Application *)(((char *)((struct __ecereNameSpace__ecere__com__Module *)(((char *)_class->module + 12)))->application + 300)))->isGUIApp;
+struct __ecereNameSpace__ecere__com__Instance * module = _class->module;
+struct __ecereNameSpace__ecere__com__Instance * application = module ? ((struct __ecereNameSpace__ecere__com__Module *)(((char *)module + structSize_Instance)))->application : (((void *)0));
+int flags = application ? (unsigned int)((struct __ecereNameSpace__ecere__com__Application *)(((char *)application + structSize_Module)))->isGUIApp : 0;
 unsigned int inCompiler = (flags & 8) ? 0x1 : 0x0;
 
 if(inCompiler)
index 5fb27e6..5b9e157 100644 (file)
@@ -4349,7 +4349,9 @@ public dllexport void * eInstance_New(Class _class)
 #endif
       {
          int size = _class.structSize;
-         int flags = _class.module.application.isGUIApp;
+         Module module = _class.module;
+         Application application = module ? module.application : null;
+         int flags = application ? application.isGUIApp : 0;
          bool inCompiler = (flags & 8) ? true : false;
          if(inCompiler)
          {