diff --git a/ext/modplug/gstmodplug.cc b/ext/modplug/gstmodplug.cc index 30c5952ab2..af6de488bb 100644 --- a/ext/modplug/gstmodplug.cc +++ b/ext/modplug/gstmodplug.cc @@ -298,11 +298,15 @@ gst_modplug_src_query (GstPad * pad, GstObject * parent, GstQuery * query) gst_query_parse_position (query, &format, NULL); if (format == GST_FORMAT_TIME) { gint64 pos; + guint32 max; - pos = (modplug->song_length * modplug->mSoundFile->GetCurrentPos ()); - pos /= modplug->mSoundFile->GetMaxPosition (); - gst_query_set_position (query, format, pos); - res = TRUE; + max = modplug->mSoundFile->GetMaxPosition(); + if (max > 0) { + pos = (modplug->song_length * modplug->mSoundFile->GetCurrentPos ()) / + max; + gst_query_set_position (query, format, pos); + res = TRUE; + } } } break;