From 9d58546475a436baa23ab9222a0e83017f17a965 Mon Sep 17 00:00:00 2001
From: Christophe Geuzaine <cgeuzaine@ulg.ac.be>
Date: Thu, 26 Aug 2010 12:41:24 +0000
Subject: [PATCH] don't load dataset if model is empty

---
 Post/PViewIO.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Post/PViewIO.cpp b/Post/PViewIO.cpp
index ab4bfdee36..7589fe8ea5 100644
--- a/Post/PViewIO.cpp
+++ b/Post/PViewIO.cpp
@@ -88,6 +88,12 @@ bool PView::readMSH(std::string fileName, int fileIndex)
     return false;
   }
 
+  GModel *model = GModel::current();
+  if(model->empty()){
+    Msg::Error("Model is empty: please load a mesh before loading the dataset");
+    return false;
+  }
+
   char str[256] = "XXX";
   int index = -1;
   bool binary = false, swap = false;
-- 
GitLab