Skip to content

Commit

Permalink
Analyzer: fix crash if host didn't set srate before opening the UI (Q…
Browse files Browse the repository at this point in the history
…Tractor)
  • Loading branch information
boomshop committed Jul 3, 2018
1 parent 7afdefc commit 6ec9e1a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/analyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ void analyzer::draw(int subindex, float *data, int points, bool fftdone) const
int _last = -1; // used for mode 10 (parallel spectralizer) to prevent overwriting real values with INFINITY
float posneg = 1;
int __speed = 16 - (int)_speed;
if (lintrans < 0) {
if (lintrans < 0 && srate) {
// accuracy was changed so we have to recalc linear transition
int _lintrans = (int)((float)points * log((20.f + 2.f * \
(float)srate / (float)_accuracy) / 20.f) / log(1000.f));
Expand Down Expand Up @@ -399,7 +399,7 @@ void analyzer::draw(int subindex, float *data, int points, bool fftdone) const
// we have logarithmic view enabled
_iter = std::max(1, (int)floor(freq * (float)_accuracy / (float)srate));
}
if(_iter > iter) {
if(_iter > iter && srate) {
// we are flipping one step further in drawing
if(fftdone and i) {
// ################################
Expand Down Expand Up @@ -770,6 +770,9 @@ void analyzer::draw(int subindex, float *data, int points, bool fftdone) const
data[i / 2] = INFINITY;
data[points / 2 + i / 2] = INFINITY;
}
else {
data[i] = INFINITY;
}
}
}
}
Expand Down

0 comments on commit 6ec9e1a

Please sign in to comment.