Fix genre selection segfault
(upstream git commit d20878bce0c0d84e5b49d1b9642e71bb0d18341a)
This commit is contained in:
parent
fdcaa42737
commit
f162a1b58a
@ -1,8 +1,9 @@
|
||||
# $OpenBSD: Makefile,v 1.24 2011/12/13 09:10:09 dcoppa Exp $
|
||||
# $OpenBSD: Makefile,v 1.25 2011/12/19 12:44:37 dcoppa Exp $
|
||||
|
||||
COMMENT = console client for pandora
|
||||
|
||||
DISTNAME = pianobar-2011.12.11
|
||||
REVISION = 0
|
||||
EXTRACT_SUFX = .tar.bz2
|
||||
CATEGORIES = audio
|
||||
|
||||
|
66
audio/pianobar/patches/patch-src_ui_c
Normal file
66
audio/pianobar/patches/patch-src_ui_c
Normal file
@ -0,0 +1,66 @@
|
||||
$OpenBSD: patch-src_ui_c,v 1.5 2011/12/19 12:44:37 dcoppa Exp $
|
||||
|
||||
Fix genre selection segfault
|
||||
(upstream git commit d20878bce0c0d84e5b49d1b9642e71bb0d18341a)
|
||||
|
||||
--- src/ui.c.orig Sun Dec 11 19:39:27 2011
|
||||
+++ src/ui.c Mon Dec 19 13:37:33 2011
|
||||
@@ -584,16 +584,19 @@ void BarStationFromGenre (BarApp_t *app) {
|
||||
i++;
|
||||
curCat = curCat->next;
|
||||
}
|
||||
- /* select category or exit */
|
||||
- BarUiMsg (&app->settings, MSG_QUESTION, "Select category: ");
|
||||
- if (BarReadlineInt (&i, &app->input) == 0) {
|
||||
- return;
|
||||
- }
|
||||
- curCat = app->ph.genreStations;
|
||||
- while (curCat != NULL && i > 0) {
|
||||
- curCat = curCat->next;
|
||||
- i--;
|
||||
- }
|
||||
+
|
||||
+ do {
|
||||
+ /* select category or exit */
|
||||
+ BarUiMsg (&app->settings, MSG_QUESTION, "Select category: ");
|
||||
+ if (BarReadlineInt (&i, &app->input) == 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+ curCat = app->ph.genreStations;
|
||||
+ while (curCat != NULL && i > 0) {
|
||||
+ curCat = curCat->next;
|
||||
+ i--;
|
||||
+ }
|
||||
+ } while (curCat == NULL);
|
||||
|
||||
/* print all available stations */
|
||||
curGenre = curCat->genres;
|
||||
@@ -603,15 +606,19 @@ void BarStationFromGenre (BarApp_t *app) {
|
||||
i++;
|
||||
curGenre = curGenre->next;
|
||||
}
|
||||
- BarUiMsg (&app->settings, MSG_QUESTION, "Select genre: ");
|
||||
- if (BarReadlineInt (&i, &app->input) == 0) {
|
||||
- return;
|
||||
- }
|
||||
- curGenre = curCat->genres;
|
||||
- while (curGenre != NULL && i > 0) {
|
||||
- curGenre = curGenre->next;
|
||||
- i--;
|
||||
- }
|
||||
+
|
||||
+ do {
|
||||
+ BarUiMsg (&app->settings, MSG_QUESTION, "Select genre: ");
|
||||
+ if (BarReadlineInt (&i, &app->input) == 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+ curGenre = curCat->genres;
|
||||
+ while (curGenre != NULL && i > 0) {
|
||||
+ curGenre = curGenre->next;
|
||||
+ i--;
|
||||
+ }
|
||||
+ } while (curGenre == NULL);
|
||||
+
|
||||
/* create station */
|
||||
BarUiMsg (&app->settings, MSG_INFO, "Adding shared station \"%s\"... ", curGenre->name);
|
||||
reqData.id = curGenre->musicId;
|
Loading…
Reference in New Issue
Block a user