Skip to content

Commit 8af7c8a

Browse files
committed
check that there is at least one ninja in ninjas before deleting ninja[0] in ninjaArmy destructor, fixes #586
1 parent ad71e6d commit 8af7c8a

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

src/ninja/ninjaArmy.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ ninjaArmy::ninjaArmy(const ninjaArmy& A)
5757
*/
5858
ninjaArmy::~ninjaArmy()
5959
{
60-
delete ninjas[0];
60+
if(ninjas.size() >= 1)
61+
{
62+
delete ninjas[0];
63+
}
6164
destoryLocalData();
6265
}
6366

@@ -123,7 +126,7 @@ void ninjaArmy::makePointArmy(std::vector<boost::posix_time::ptime> timeList,
123126
//interpolate raw data to actual time steps
124127

125128
int stationFormat = wxStation::GetHeaderVersion(stationFileName.c_str());
126-
129+
127130
if (stationFormat==1) //This is if it is the old format->1 step, no time knowledge
128131
{
129132
stationList = pointInitialization::readWxStations(demFile,timeZone);

0 commit comments

Comments
 (0)