The bug was because the code adds and extra 2 frequency bins below and above the frequency band that is cropped out of a spectrogram, and it doesn't check for going below 0 or above the maximum frequency index when adding these extra bins. In the user's case, the index for the low bin was going below 0 after subtracting 2 from 1, and then the spectrogram was coming out empty.
The bug was because the code adds and extra 2 frequency bins below and above the frequency band that is cropped out of a spectrogram, and it doesn't check for going below 0 or above the maximum frequency index when adding these extra bins. In the user's case, the index for the low bin was going below 0 after subtracting 2 from 1, and then the spectrogram was coming out empty.