Skip to content

Commit dadaa9e

Browse files
authored
Refactor nil checking for video_duration
This commit short-circuits the following check added in the previous commit (d8fcff5) [1]: ``` if video_duration and video_duration ~= nil then video_duration = tonumber(video_duration) else video_duration = 0 end ``` [1] gsbabil@d8fcff5
1 parent d8fcff5 commit dadaa9e

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

scripts/SimpleHistory.lua

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2115,12 +2115,8 @@ function history_resume_option()
21152115
if video_time > 0 then return end
21162116
local logged_time = 0
21172117
local percentage = 0
2118-
local video_duration = mp.get_property_number('duration')
2119-
if video_duration and video_duration ~= nil then
2120-
video_duration = tonumber(video_duration)
2121-
else
2122-
video_duration = 0
2123-
end
2118+
local video_duration = mp.get_property_number('duration') or 0
2119+
21242120
list_contents = read_log_table()
21252121
if not list_contents or not list_contents[1] then return end
21262122
for i = #list_contents, 1, -1 do

0 commit comments

Comments
 (0)