mirror of
https://github.com/SuperBFG7/ympd
synced 2025-08-05 21:43:51 +00:00
Fix crash, if unkown cmd is submitted
This commit is contained in:
parent
ab9ce46239
commit
d1876fd166
@ -61,13 +61,17 @@ void callback_mympd(struct mg_connection *nc, const struct mg_str msg)
|
|||||||
float float_buf;
|
float float_buf;
|
||||||
char *p_charbuf1, *p_charbuf2;
|
char *p_charbuf1, *p_charbuf2;
|
||||||
struct mympd_state { int a; int b; } state = { .a = 0, .b = 0 };
|
struct mympd_state { int a; int b; } state = { .a = 0, .b = 0 };
|
||||||
|
enum mpd_cmd_ids cmd_id;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
fprintf(stdout,"Got request: %s\n",msg.p);
|
fprintf(stdout,"Got request: %s\n",msg.p);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
json_scanf(msg.p, msg.len, "{cmd:%Q}", &cmd);
|
je = json_scanf(msg.p, msg.len, "{cmd:%Q}", &cmd);
|
||||||
enum mpd_cmd_ids cmd_id = get_cmd_id(cmd);
|
if (je == 1)
|
||||||
|
cmd_id = get_cmd_id(cmd);
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
|
||||||
if(cmd_id == -1)
|
if(cmd_id == -1)
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user