From adcae533d09a11074119a5ef36f7b87af37bce6e Mon Sep 17 00:00:00 2001 From: hkc Date: Tue, 17 Oct 2023 16:20:16 +0300 Subject: [PATCH] Don't add empty songs into ToC --- tape-playlist.lua | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tape-playlist.lua b/tape-playlist.lua index 71f5be5..65393f4 100644 --- a/tape-playlist.lua +++ b/tape-playlist.lua @@ -56,13 +56,15 @@ function() for i = 1, 48 do local offset = read32() local length = read32() - local title = drive.read(117) - table.insert(table_of_contents, { - title = length > 0 and title or nil, - offset = offset, - length = length, - ending = offset + length - }) + local title = drive.read(117):gsub("\x00", "") + if length > 0 then + table.insert(table_of_contents, { + title = title, + offset = offset, + length = length, + ending = offset + length + }) + end end end end