Skip to content

Commit

Permalink
Fix segfault caused by uninitialized `cluster.series.timeseriesNumber…
Browse files Browse the repository at this point in the history
…s` (#1876)

```cpp
void Area::resizeAllTimeseriesNumbers(uint nbYears) 
{ 
    assert(hydro.series and "series must not be nullptr !"); 

    load.series.timeseriesNumbers.reset(1, nbYears); 
    solar.series.timeseriesNumbers.reset(1, nbYears); 
    wind.series.timeseriesNumbers.reset(1, nbYears); 
    hydro.series->timeseriesNumbers.reset(1, nbYears); 
    for (auto& namedLink : links) 
    { 
        AreaLink* link = namedLink.second; 
        link->timeseriesNumbers.reset(1, nbYears); 
    } 
    thermal.resizeAllTimeseriesNumbers(nbYears); // resize is called here
    renewable.resizeAllTimeseriesNumbers(nbYears); // resize is called here
}
```
  • Loading branch information
flomnes authored Jan 15, 2024
1 parent bfdedf6 commit a7b9cd7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libs/antares/study/parts/common/cluster_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void ClusterList<ClusterT>::clear()
template<class ClusterT>
void ClusterList<ClusterT>::resizeAllTimeseriesNumbers(uint n)
{
each([&](Cluster& cluster) { cluster.series.timeseriesNumbers.resize(1, n); });
each([&](Cluster& cluster) { cluster.series.timeseriesNumbers.reset(1, n); });
}

#define SEP IO::Separator
Expand Down

0 comments on commit a7b9cd7

Please sign in to comment.