Help with implementing this HPF

Hey everyone! I am very new to the JUCE framework and C++ in general.  I've been reading Will Pirkle's book Designing Audio Effect Plugins in C++

and have learned a lot from it, but I have had trouble implementing the Linkwitz-Riley HPF from the book.  The LPF seemed to work great but when I changed the coefficients on the bi-quad to be a HPF, it didnt work.

I also tried a simpler version of a HPF that I found her and it still didnt behave right. I'm guessing it's a problem in the way that I am manipulating the samples rather than the equations im using.

Here is the code from my ProcessBlock

fc is changed by a slider that goes from 10-22050.

void HighpassFilterAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuffer& midiMessages)
    for (int i = getNumInputChannels(); i < getNumOutputChannels(); ++i)
        buffer.clear (i, 0, buffer.getNumSamples());

    const float* Lxn;
    const float* Rxn;
    float* Lyn;
    float* Ryn;

    Lxn = buffer.getReadPointer(0);
    Rxn = buffer.getReadPointer(1);
    Lyn = buffer.getWritePointer(0);
    Ryn = buffer.getWritePointer(1);
    fs = 44100;

    c = 1.0/tan(PI*fc/fs);

    a0 = 1.0/(1.0+r*c+c*c);
    a1 = -2*a0;
    a2 = a0;
    b1 = 2.0*(c*c-1.0)*a0;
    b2 = (1.0-r*c+c*c)*a0;
        for(int i = 0; i<buffer.getNumSamples();i++)
            //transfer eqautions
            Lyn[i] = a0*Lxn[i]+a1*Lxn1+a2*Lxn2-b1*Lyn1-b2*Lyn2;
            Ryn[i] = a0*Rxn[i]+a1*Rxn1+a2*Rxn2-b1*Ryn1-b2*Ryn2;

                Lxn2 = Lxn1;
                Lxn1 = Lxn[i];
                Rxn2 = Rxn1;
                Rxn1 = Rxn[i];

                Lyn2 = Lyn1;
                Lyn1 = Lyn[i];
                Ryn2 = Ryn1;
                Ryn1 = Ryn[i];

Lxn/Lyn are pointing to the same buffers. Don’t use Lxn and replace the processing with this (only one channel shown):

const float xL = Lyn[i];

Lyn[i] = a0*xL+a1*Lxn1+a2*Lxn2-b1*Lyn1-b2*Lyn2;

Lxn2 = Lxn1;
Lxn1 = xL;
Lyn2 = Lyn1;
Lyn1 = Lyn[i];

If the plugin can also be used on mono channels it will crash there (no right channel).

Thanks so much ckk! That did the trick! I truely appreciatte the help because this has been frustrating me for several days now.  No I can continue on my path to making a somewhat useful plugin haha. 

I have to say, I've never been so excited to learn as I am right now. JUCE combined with Will Pirkles book is awesome.