summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/player/command.c b/player/command.c
index 938d9fa988..fd5ad60891 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2705,26 +2705,22 @@ static int mp_property_playlist_pos_x(void *ctx, struct m_property *prop,
{
MPContext *mpctx = ctx;
struct playlist *pl = mpctx->playlist;
- if (!pl->num_entries)
- return M_PROPERTY_UNAVAILABLE;
switch (action) {
case M_PROPERTY_GET: {
int pos = playlist_entry_to_index(pl, pl->current);
- if (pos < 0)
- return M_PROPERTY_UNAVAILABLE;
- *(int *)arg = pos + base;
+ *(int *)arg = pos < 0 ? -1 : pos + base;
return M_PROPERTY_OK;
}
case M_PROPERTY_SET: {
int pos = *(int *)arg - base;
- struct playlist_entry *e = playlist_entry_from_index(pl, pos);
- if (!e)
- return M_PROPERTY_ERROR;
- mp_set_playlist_entry(mpctx, e);
+ mp_set_playlist_entry(mpctx, playlist_entry_from_index(pl, pos));
return M_PROPERTY_OK;
}
- case M_PROPERTY_GET_TYPE: {
+ case M_PROPERTY_GET_TYPE:
+ *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_INT};
+ return M_PROPERTY_OK;
+ case M_PROPERTY_GET_CONSTRICTED_TYPE: {
struct m_option opt = {
.type = CONF_TYPE_INT,
.min = base,