From 171065ff333670747ee8e12ea55b430a6675c373 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Thu, 16 Oct 2014 11:26:15 +0200 Subject: Fix for the case that a workspace has no fits --- inst/GUI/gmkin.R | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'inst/GUI/gmkin.R') diff --git a/inst/GUI/gmkin.R b/inst/GUI/gmkin.R index 7932331..1a18be0 100644 --- a/inst/GUI/gmkin.R +++ b/inst/GUI/gmkin.R @@ -116,15 +116,20 @@ upload_file_handler <- function(h, ...) workspace <- get(project_name) # Check for old workspaces created using mkin < 0.9-32 that aren't loaded properly - if (is.null(workspace$f[[1]]$method.modFit)) { - stopmessage <- paste("Could not load workspace ", - project_file, - ". It seems it was created using mkin with version < 0.9-32", - sep = "") - galert(stopmessage, parent = w) - svalue(sb) <- stopmessage - } else { + workspace_old <- FALSE + if (length(workspace$f) > 0) { + if (is.null(workspace$f[[1]]$method.modFit)) { + stopmessage <- paste("Could not load workspace ", + project_file, + ". It seems it was created using mkin with version < 0.9-32", + sep = "") + galert(stopmessage, parent = w) + svalue(sb) <- stopmessage + workspace_old <- TRUE + } + } + if (!workspace_old) { # Update project file name and status bar svalue(pr.ge) <- project_name svalue(sb) <- paste("Loaded project file", project_file) -- cgit v1.2.1