MSP430FR5994: ISR Trap error in SPI communication

Part Number: MSP430FR5994

Hello,

I am trying to send a packet using the SPI communication. But when i am switch from first if condition to the second if condition i am facing a isr_trap error. Please drop your insights on this error.Thanks in advance

#include <msp430.h> 
#include <stdio.h>
#include <stdint.h>

void init_SPI()
{
    UCB1CTLW0 |=UCSWRST;
    UCB1CTLW0 &=~UCMSB;
    UCB1CTLW0 |=UCMST;
    UCB1CTLW0 |=UCMODE0;
    UCB1CTLW0 |= UCSSEL__SMCLK;

    UCB1BRW   =10;

    P5SEL0 |= BIT0 | BIT1 | BIT2;

    PM5CTL0 &=~LOCKLPM5;
    UCB1CTLW0 &=~UCSWRST;

    UCB1IE |=~UCTXIE;

    __bis_SR_register(GIE);
}

/**
 * main.c
 */
void main(void)
{
    WDTCTL = WDTPW | WDTHOLD;   // stop watchdog timer
    int i=0;
    init_SPI();
 while(1)
 {
    if(UCB1IFG & UCTXIFG0)
    {
        UCB1TXBUF |=0X4D;
    }
    if(UCB1IFG & UCTXIFG0)
    {
        UCB1TXBUF |=0X5D;
    }
    if(UCB1IFG & UCTXIFG0)
    {
        UCB1TXBUF |=0X6D;
    }
 }
}