Atoms: fixed error message at the console after the closing of atomsGui 84/14384/3
Vladislav TRUBKIN [Wed, 9 Apr 2014 14:07:51 +0000 (16:07 +0200)]
at the case if it was resized many time.

Change-Id: Ia24ce6a15813a8a398ed341f05ae50aee13292a6

scilab/modules/atoms/macros/atoms_gui/atomsResize.sci
scilab/modules/atoms/macros/atoms_internals/atomsGetHomeListboxElts.sci

index d2b8e71..299a8b4 100644 (file)
@@ -8,12 +8,17 @@
 // http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
 
 function atomsResize()
+
+    if ~isempty(get("HomeListbox")) then
     // Load Atoms Internals lib if it's not already loaded
-    if ~exists("atomsinternalslib") then
-        load("SCI/modules/atoms/macros/atoms_internals/lib");
-    end
+        if ~exists("atomsinternalslib") then
+            load("SCI/modules/atoms/macros/atoms_internals/lib");
+        end
 
-    HomeElements = atomsGetHomeListboxElts();
-    set("HomeListbox", "String", HomeElements("items_str"));
-    set("HomeListbox", "UserData", HomeElements("items_mat"));
+        HomeElements = atomsGetHomeListboxElts();
+        if ~isempty(get("HomeListbox")) then
+            set("HomeListbox", "String", HomeElements("items_str"));
+            set("HomeListbox", "UserData", HomeElements("items_mat"));
+        end
+    end
 endfunction
index 6cfcfbe..6919f13 100644 (file)
@@ -16,18 +16,21 @@ function elements = atomsGetHomeListboxElts()
     installed  = atomsGetInstalled();
     tmp = atomsAutoloadList("all")
     autoloaded = tmp(:,1)
-    allModules = get("atomsFigure", "UserData");
+    if ~isempty(get("atomsFigure")) then
+        allModules = get("atomsFigure", "UserData");
 
-    items_str  = atomsSetInstalledList(installed)
-    items_mat = installed(:,1)
-    items_mat = [emptystr(items_mat)+"module" items_mat ]
+        items_str  = atomsSetInstalledList(installed)
+        items_mat = installed(:,1)
+        items_mat = [emptystr(items_mat)+"module" items_mat ]
 
-    if items_str==[] then
-        elements("items_str") = "";
+        if items_str==[] then
+            elements("items_str") = "";
+        else
+            elements("items_str") = items_str;
+        end
+
+        elements("items_mat") = items_mat;
     else
-        elements("items_str") = items_str;
+        elements = [];
     end
-
-    elements("items_mat") = items_mat;
-
 endfunction