- Fix sigsegv when no parameter is passed on the cmdline

git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@647 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-06-21 14:54:59 +00:00
parent 77e61e0b91
commit 167f9ad437
1 changed files with 8 additions and 5 deletions

View File

@ -37,7 +37,8 @@
#include "backend/observed_subject.hh" #include "backend/observed_subject.hh"
#include "backend/schedulable_queue.hh" #include "backend/schedulable_queue.hh"
#include "backend/dynamic_schedulable.hh" #include "backend/dynamic_schedulable.hh"
#include "templates/smartp.hh"
#include "smartp.hh"
using namespace sgpem; using namespace sgpem;
using namespace std; using namespace std;
@ -91,7 +92,7 @@ public:
void _standard_test() void _standard_test()
{ {
// checks if the Singleton Pattern has been actually implemented // checks if the Singleton Pattern has been actually implemented
if (&History::get_instance() != &History::get_instance()) std::cout << "get_instance"; if (&History::get_instance() != &History::get_instance()) std::cout << "get_instance" << endl;
// checks if the History is long how it should be // checks if the History is long how it should be
if (History::get_instance().get_current_time() != _history_length) std::cout << "get_current_time" << endl <<History::get_instance().get_current_time() <<',' << _history_length<<endl; if (History::get_instance().get_current_time() != _history_length) std::cout << "get_current_time" << endl <<History::get_instance().get_current_time() <<',' << _history_length<<endl;
@ -102,11 +103,11 @@ public:
// watch out here, it's if (NOT ...) operator != was not available. // watch out here, it's if (NOT ...) operator != was not available.
if (!(*History::get_instance().get_simulation_status_at(i) == *_get_simulation_status_at[i])) if (!(*History::get_instance().get_simulation_status_at(i) == *_get_simulation_status_at[i]))
{ {
std::cout << "get_simulation_status_at"; std::cout << "get_simulation_status_at" << endl;
} }
if (History::get_instance().get_scheduled_at(i) != memory::smart_ptr<DynamicSchedulable>(NULL) && !(*History::get_instance().get_scheduled_at(i) == *_get_scheduled_at[i])) if (History::get_instance().get_scheduled_at(i) != memory::smart_ptr<DynamicSchedulable>(NULL) && !(*History::get_instance().get_scheduled_at(i) == *_get_scheduled_at[i]))
{ {
std::cout << "get_simulation_status_at"; std::cout << "get_simulation_status_at" << endl;
} }
} }
return; return;
@ -188,6 +189,8 @@ main(int argc, char** argv)
std::string command("ERERERT"); // the sequence of commands to test std::string command("ERERERT"); // the sequence of commands to test
if(argc > 1)
command = argv[1]; command = argv[1];
// sets up the test data // sets up the test data