rFlex / SCWaveformView

A blazing fast customizable waveform view
Apache License 2.0
457 stars 59 forks source link

CALayerInvalidGeometry Exception #16

Closed jamesfzhang closed 8 years ago

jamesfzhang commented 8 years ago

I'm seeing this error after setting the asset. Any ideas?

Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [0 nan]'

Trace leads to SCWaveformView.m's layoutSubviews.

jamesfzhang commented 8 years ago

Figured it out! The dimensions weren't set :)

nlabhart commented 8 years ago

@jamesfzhang where did you set the dimensions? Do you mean the frame on the scrollview or the waveformview?

JackYoustra commented 5 years ago

@rFlex @jamesfzhang could you reopen? This bug has its issue in indexAtStart can be -1, causing sample = -INFINITY, causing line 232 (where layer.frame is set) to have a nan value for y and height. A simple hack to fix this is checking if pixelHeight = NaN and setting to a constant if so. Zero works for empty space, and pointSize works for a tiny dash.

This can be done by adding a line after line 208: if (isnan(pixelHeight)) pixelHeight = 0.0;