open-dynaMIX/simple-mpv-webui

webui.lua:173: attempt to perform arithmetic on local 'a' (a nil value)

Closed this issue · 3 comments

Playing: Music/Compilations/Guradians of the Galaxy vol. 1/The Sweet Fox On The Run.mp3
[ffmpeg/demuxer] mp3: Estimating duration from bitrate, this may be inaccurate
     Video --vid=1 [P] (mjpeg 316x316)
 (+) Audio --aid=1 (mp3 2ch 44100Hz)
File tags:
 Artist: The Sweet
 Album: Guardians of the Galaxy: Awesome Mix, Vol. 2
 Album_Artist: Various Artists
 Composer: Dawn Foxes Music
 Genre: Soundtrack
 Performer: Dawn Foxes Music
 Title: Fox on the Run (Single Version)
 Track: 2
AO: [pulse] 44100Hz stereo 2ch s16
[webui] 
[webui] stack traceback:
[webui]         /home/alexander/.config/mpv/scripts/webui.lua:173: in function 'round'
[webui]         /home/alexander/.config/mpv/scripts/webui.lua:243: in function 'build_json_response'
[webui]         /home/alexander/.config/mpv/scripts/webui.lua:277: in function </home/alexander/.config/mpv/scripts/webui.lua:276>
[webui]         (...tail calls...)
[webui]         /home/alexander/.config/mpv/scripts/webui.lua:371: in function 'listen'
[webui]         /home/alexander/.config/mpv/scripts/webui.lua:408: in function 'cb'
[webui]         mp.defaults:320: in function 'process_timers'
[webui]         mp.defaults:478: in function 'dispatch_events'
[webui]         mp.defaults:451: in function <mp.defaults:450>
[webui]         [C]: in ?
[webui]         [C]: in ?
[webui] Lua error: /home/alexander/.config/mpv/scripts/webui.lua:173: attempt to perform arithmetic on local 'a' (a nil value)

this causes a crash of the webui.

...actually, I have no idea why that happened. i cant reproduce this

even playing the same track

Thanks a lot for reporting. I ran into the same issue yesterday and had a hard time to reproduce it today.

It only happens on one of my hosts and only when streaming multiple files over sftp and skipping tracks. Working on a fix now.

If the file is not fully loaded, mpv returns nil when fetching the status properties. Obviously this is much easier to trigger with a remote file.