aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAaron Griffith <aargri@gmail.com>2010-06-25 19:20:20 +0200
committerMax Kellermann <max@duempel.org>2010-06-25 19:20:20 +0200
commitca6110d92fac1cab5f29045a1108efed9174dde4 (patch)
treefe69fcb5929819b855ee4464cca18be328f064aa /src
parenta219d488d014903cec4799ab5519b482fa1eab42 (diff)
downloadmpd-ca6110d92fac1cab5f29045a1108efed9174dde4.tar.gz
mpd-ca6110d92fac1cab5f29045a1108efed9174dde4.tar.xz
mpd-ca6110d92fac1cab5f29045a1108efed9174dde4.zip
playlist_list: wait for input stream to become ready
Fixes an assertion failure in the input_stream_seek() call.
Diffstat (limited to '')
-rw-r--r--src/playlist_list.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/playlist_list.c b/src/playlist_list.c
index 78a1040f7..5220de63e 100644
--- a/src/playlist_list.c
+++ b/src/playlist_list.c
@@ -192,11 +192,22 @@ playlist_list_open_uri(const char *uri)
static struct playlist_provider *
playlist_list_open_stream_mime(struct input_stream *is)
{
+ GError* error = NULL;
struct playlist_provider *playlist;
assert(is != NULL);
assert(is->mime != NULL);
+ while (!is->ready) {
+ int ret = input_stream_buffer(is, &error);
+ if (ret < 0) {
+ input_stream_close(is);
+ g_warning("%s", error->message);
+ g_error_free(error);
+ return NULL;
+ }
+ }
+
for (unsigned i = 0; playlist_plugins[i] != NULL; ++i) {
const struct playlist_plugin *plugin = playlist_plugins[i];
@@ -220,11 +231,22 @@ playlist_list_open_stream_mime(struct input_stream *is)
static struct playlist_provider *
playlist_list_open_stream_suffix(struct input_stream *is, const char *suffix)
{
+ GError* error = NULL;
struct playlist_provider *playlist;
assert(is != NULL);
assert(suffix != NULL);
+ while (!is->ready) {
+ int ret = input_stream_buffer(is, &error);
+ if (ret < 0) {
+ input_stream_close(is);
+ g_warning("%s", error->message);
+ g_error_free(error);
+ return NULL;
+ }
+ }
+
for (unsigned i = 0; playlist_plugins[i] != NULL; ++i) {
const struct playlist_plugin *plugin = playlist_plugins[i];