I have exactly the same problem but I need a different solution... This is my code:
When connected to my BlueTooth module in AT command mode (38400 baud) if I issue a command like "AT+UART?" then the response form the BT module is:
"+UART=38400,0,0\r\nOK\r\n" and everything works fine and bt_uart_response string is "+UART=38400,0,0" and bt_uart_status string is "OK". But when I issue a command like "AT+NAME=MyBTModule" then the response is just "OK\r\n" and my MCU hangs there, of course on the second UART1_Read_Text function. Can you help me please how to change the second function, expected strings is just "OK" or nothing. Oh and I forgot, the MCU is PIC18F4520.