aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/command.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/src/command.c b/src/command.c
index 21ace50d3..aab63998e 100644
--- a/src/command.c
+++ b/src/command.c
@@ -1510,17 +1510,17 @@ handle_idle(struct client *client,
static enum command_return
handle_sticker_song(struct client *client, int argc, char *argv[])
{
- struct song *song = db_get_song(argv[3]);
-
- if (song == NULL) {
- command_error(client, ACK_ERROR_NO_EXIST,
- "no such song");
- return COMMAND_RETURN_ERROR;
- }
-
if (argc == 5 && strcmp(argv[1], "get") == 0) {
+ struct song *song;
char *value;
+ song = db_get_song(argv[3]);
+ if (song == NULL) {
+ command_error(client, ACK_ERROR_NO_EXIST,
+ "no such song");
+ return COMMAND_RETURN_ERROR;
+ }
+
value = sticker_song_get_value(song, argv[4]);
if (value == NULL) {
command_error(client, ACK_ERROR_NO_EXIST,
@@ -1533,7 +1533,17 @@ handle_sticker_song(struct client *client, int argc, char *argv[])
return COMMAND_RETURN_OK;
} else if (argc == 4 && strcmp(argv[1], "list") == 0) {
- struct sticker *sticker = sticker_song_get(song);
+ struct song *song;
+ struct sticker *sticker;
+
+ song = db_get_song(argv[3]);
+ if (song == NULL) {
+ command_error(client, ACK_ERROR_NO_EXIST,
+ "no such song");
+ return COMMAND_RETURN_ERROR;
+ }
+
+ sticker = sticker_song_get(song);
if (NULL == sticker) {
command_error(client, ACK_ERROR_NO_EXIST,
"no stickers found");
@@ -1545,8 +1555,16 @@ handle_sticker_song(struct client *client, int argc, char *argv[])
return COMMAND_RETURN_OK;
} else if (argc == 6 && strcmp(argv[1], "set") == 0) {
+ struct song *song;
bool ret;
+ song = db_get_song(argv[3]);
+ if (song == NULL) {
+ command_error(client, ACK_ERROR_NO_EXIST,
+ "no such song");
+ return COMMAND_RETURN_ERROR;
+ }
+
ret = sticker_song_set_value(song, argv[4], argv[5]);
if (!ret) {
command_error(client, ACK_ERROR_SYSTEM,