Skip to content

Commit

Permalink
fix: fixed statistics segfault #88
Browse files Browse the repository at this point in the history
  • Loading branch information
klonyyy committed Oct 2, 2024
1 parent 2be05e3 commit 877cb25
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Statistics/Statistics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <algorithm>
#include <cmath>
#include <iostream>
#include <numeric>
#include <vector>

Expand Down Expand Up @@ -122,9 +123,11 @@ class Statistics
size_t end = time.size() - 1;
size_t i = 1;

if (data.empty() || time.empty())
if (data.empty() || time.empty() || data.size() < 2 || time.size() < 2)
return false;

std::cout << data.size() << std::endl;

while (data[i] == data[0] && i < data.size())
i++;
start = i;
Expand Down

0 comments on commit 877cb25

Please sign in to comment.