summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorLars-Dominik Braun <PromyLOPh@gmail.com>2008-07-07 20:56:48 +0200
committerLars-Dominik Braun <PromyLOPh@gmail.com>2008-07-07 20:56:48 +0200
commite0b48b5fcc97b4979b32c79fe82c2fab5af89b86 (patch)
tree35dfd2bc6eaff729747ae3337f9c39f46560a066 /src/main.c
parent51edb36f6bd9d119c12ef893ecc1d3541f80b00a (diff)
downloadpianobar-windows-e0b48b5fcc97b4979b32c79fe82c2fab5af89b86.tar.gz
pianobar-windows-e0b48b5fcc97b4979b32c79fe82c2fab5af89b86.tar.bz2
pianobar-windows-e0b48b5fcc97b4979b32c79fe82c2fab5af89b86.zip
client: Avoid segfault when PianoSearchMusic returned with an error
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 869092c..0a31a5e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -164,7 +164,10 @@ char *BarUiSelectMusicId (PianoHandle_t *ph) {
lineBuf = readline ("Search for artist/title\n");
if (lineBuf != NULL && strlen (lineBuf) > 0) {
- PianoSearchMusic (ph, lineBuf, &searchResult);
+ if (PianoSearchMusic (ph, lineBuf, &searchResult) != PIANO_RET_OK) {
+ free (lineBuf);
+ return NULL;
+ }
if (searchResult.songs != NULL && searchResult.artists != NULL) {
printf ("Is this an [a]rtist or [t]rack name? Press c to abort.\n");
read (fileno (stdin), &yesnoBuf, sizeof (yesnoBuf));