If Then version of script not working- very strange

I'm building a sketch which will receive an IR signal and transmit a different IR code. A first version is working perfectly.

Here is the salient portion of the working sketch. All variables are defined and the IRsmallDecoder library is used.

void setup() {
  delay(500);
  pinMode(LED_BUILTIN, OUTPUT);
  pinMode(IRLEDpin, OUTPUT);
  digitalWrite(IRLEDpin, LOW);
  msPrev = 0;
}

void loop() {
  unsigned long msCurr = millis();         //read current milliseconds time
  if (msCurr - msPrev >= 3000) {              //delay for 3 sec
    digitalWrite(LED_BUILTIN, HIGH);   // flash LED
    delay(100);
    digitalWrite(LED_BUILTIN, LOW);
    delay(50);
    msPrev = msCurr;    //reset timer
    sendIR();
  }

This code works- every 3 seconds the LED flashes and the IR signal is transmitted, via sendIR(). But now, I want to only send the IR if a specific IR code is received and have tried to modify the loop() function.

void loop() {
 if(irDecoder.dataAvailable(irData)) {      
    if(irData.cmd == 20) {       // received code= 0x014
       digitalWrite(LED_BUILTIN, HIGH);   // flash LED
       delay(100);
       digitalWrite(LED_BUILTIN, LOW);
       delay(50);
       sendIR();     
    }
  }
}

When I run this code, the LED flashes when the proper IR code is received but the IR signal is never sent (no flashing observed on my cell phone camera). Why?!

The problem with snippets of code is that, often, the problem is in the code not posted.

You do realise you’re allowed to write if(irData.cmd == 0x14) { so you don’t need the dumb comment?

msPrev = msCurr; This time is already >150ms out

Yes, I realize that hex and dec both work. And the time is not critical. Here is a skinny version, with the problem if/then issue.

// IR sketch- not working

#define IR_SMALLD_SAMSUNG32
#define IRLEDpin  7

#include <IRsmallDecoder.h>      

IRsmallDecoder irDecoder(2);
irSmallD_t irData;

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(IRLEDpin, LOW);
}

void loop() {
 if(irDecoder.dataAvailable(irData)) {      
    if(irData.cmd == 20) {       // 0x014
      digitalWrite(LED_BUILTIN, HIGH);
      delay(100);
      digitalWrite(LED_BUILTIN, LOW);
      delay(50);
      sendIR();
    }
  }
}

void sendIR() {
  IRcarrier(4500,4500);
  IRcarrier(500,1000);
  IRcarrier(500,500);
  IRcarrier(500,1000);
  IRcarrier(500,500);
  IRcarrier(500,1000);
  IRcarrier(500,500);
  IRcarrier(4500,4500);
}

void IRcarrier(unsigned int IRpulsetimemicroseconds,unsigned int IRpausetimemicroseconds)  {
 if (IRpulsetimemicroseconds > 0) {
    for(int j=0; j < (IRpulsetimemicroseconds/13); j++)  {    
      digitalWrite(IRLEDpin, HIGH);
      delayMicroseconds(13);
      digitalWrite(IRLEDpin, LOW);
      delayMicroseconds(13);
    }
  }
  if (IRpausetimemicroseconds > 0) {
    digitalWrite(IRLEDpin, LOW);
    delayMicroseconds(IRpausetimemicroseconds);
  }
}

where is the IRLEDpin configured as an OUTPUT?

Thx @gcjr. Stupid mistake! Fixed.

do you think i haven't made similar mistakes? ... many times