[Avida-cvs] [avida-svn] r733 - development/source/actions

brysonda@myxo.css.msu.edu brysonda at myxo.css.msu.edu
Mon Jun 5 12:34:47 PDT 2006


Author: brysonda
Date: 2006-06-05 15:34:47 -0400 (Mon, 05 Jun 2006)
New Revision: 733

Modified:
   development/source/actions/PrintActions.cc
Log:
Fix PrintDominantParasiteGenotype so that it will not crash when no parasites exist.

Modified: development/source/actions/PrintActions.cc
===================================================================
--- development/source/actions/PrintActions.cc	2006-06-05 19:04:50 UTC (rev 732)
+++ development/source/actions/PrintActions.cc	2006-06-05 19:34:47 UTC (rev 733)
@@ -422,9 +422,11 @@
   void Process(cAvidaContext& ctx)
   {
     cInjectGenotype* dom = m_world->GetClassificationManager().GetBestInjectGenotype();
-    cString filename(m_filename);
-    if (filename == "") filename.Set("archive/%s", static_cast<const char*>(dom->GetName()));
-    cTestUtil::PrintGenome(m_world, dom, dom->GetGenome(), filename, m_world->GetStats().GetUpdate());
+    if (dom != NULL) {
+      cString filename(m_filename);
+      if (filename == "") filename.Set("archive/%s", static_cast<const char*>(dom->GetName()));
+      cTestUtil::PrintGenome(m_world, dom, dom->GetGenome(), filename, m_world->GetStats().GetUpdate());
+    }
   }
 };
 




More information about the Avida-cvs mailing list