Quick question regarding some of my code. [solved]

So im currently trying to display any serial data to an lcd but also have it so if you send a * over serial to the arduino it clears the screen, currently whenever i send something other then a * it shows a random character on the screen other then what i sent, then when i send a * it clears the screen as expected. Any help would be appreciated!

P.S. I have no line ending selected in the arduino serial just for testing to ensure it dosent send anything extra other then what I want it to send.

//libraries im using
#include <LCD.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

//lcd pin assignments
#define I2C_ADDR 0x27
#define BACKLIGHT_PIN 3
#define En_pin  2
#define Rw_pin  1
#define Rs_pin  0
#define D4_pin  4
#define D5_pin  5
#define D6_pin  6
#define D7_pin  7

//set lcd pins
LiquidCrystal_I2C  lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

//data 
char data[16];

void setup() {
 // begin serial
 Serial.begin(9600);

 //start lcd
 lcd.begin (16,2);
 lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
 lcd.setBacklight(HIGH);
 lcd.home ();
}

void loop() {
 handleSerial();
 if(Serial.available() )
 {
   lcd.print (data);
 }
}

void handleSerial() {
  while (Serial.available() > 0) {
    char data = Serial.read();
    switch (data) {
      case '*':
        lcd.clear();
        break;
    }
  }
}

Yes you will never get anything to the LCD because by the time it comes to printing the buffer is already empty so the if statement fails.

Put the LCD print after you find it is not a *

Grumpy_Mike:
Yes you will never get anything to the LCD because by the time it comes to printing the buffer is already empty so the if statement fails.

Put the LCD print after you find it is not a *

Did the following:

//libraries im using
#include <LCD.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

//lcd pin assignments
#define I2C_ADDR 0x27
#define BACKLIGHT_PIN 3
#define En_pin  2
#define Rw_pin  1
#define Rs_pin  0
#define D4_pin  4
#define D5_pin  5
#define D6_pin  6
#define D7_pin  7

//set lcd pins
LiquidCrystal_I2C  lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

//data 
char data[16];

void setup() {
 // begin serial
 Serial.begin(9600);

 //start lcd
 lcd.begin (16,2);
 lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
 lcd.setBacklight(HIGH);
 lcd.home ();
}

void loop() {
 handleSerial();
}

void handleSerial() {
  while (Serial.available() > 0) {
    char data = Serial.read();
    switch (data) {
      case '*':
        lcd.clear();
        break;
      default:
        lcd.print(data);
        break;
    }
  }
  
}

Works correctly now, thank you for your help my bad for not realizing my small mistake.