Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Commit

Permalink
Fix crash in model testing when partitions <= 2 (reported by Michele …
Browse files Browse the repository at this point in the history
…Leocadio)
  • Loading branch information
bqminh committed Oct 23, 2018
1 parent 326b10f commit b2a108e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions main/phylotesting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1729,8 +1729,9 @@ void testPartitionModel(Params &params, PhyloSuperTree* in_tree, ModelCheckpoint
dfvec.resize(in_tree->size());
lenvec.resize(in_tree->size());

double *dist = new double[in_tree->size()*(in_tree->size()-1)/2];
pair<int,int> *distID = new pair<int,int>[in_tree->size()*(in_tree->size()-1)/2];
// 2018-10-23: +1 to avoid crash when size <= 2
double *dist = new double[in_tree->size()*(in_tree->size()-1)/2+1];
pair<int,int> *distID = new pair<int,int>[in_tree->size()*(in_tree->size()-1)/2+1];

// sort partition by computational cost for OpenMP effciency
for (i = 0; i < in_tree->size(); i++) {
Expand Down

0 comments on commit b2a108e

Please sign in to comment.