mirror of
https://github.com/suchmememanyskill/CYD-Klipper.git
synced 2026-03-21 05:33:24 +00:00
Null check in printer state
This commit is contained in:
@@ -18,6 +18,8 @@ void KlipperPrinter::parse_state(JsonDocument &in)
|
||||
const char *state = status["webhooks"]["state"];
|
||||
const char *message = status["webhooks"]["state_message"];
|
||||
|
||||
if (state != NULL)
|
||||
{
|
||||
if (strcmp(state, "ready") == 0 && printer_data.state == PrinterStateError)
|
||||
{
|
||||
printer_data.state = PrinterStateIdle;
|
||||
@@ -26,6 +28,7 @@ void KlipperPrinter::parse_state(JsonDocument &in)
|
||||
{
|
||||
printer_data.state = PrinterStateError;
|
||||
}
|
||||
}
|
||||
|
||||
if (message != NULL && (printer_data.state_message == NULL || strcmp(printer_data.state_message, message)))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user