diff --git a/automation/include/unicode.lua b/automation/include/unicode.lua index 2f9ce952d..91136f5c6 100644 --- a/automation/include/unicode.lua +++ b/automation/include/unicode.lua @@ -34,7 +34,7 @@ module("unicode") -- Return the number of bytes occupied by the character starting at the i'th byte in s function charwidth(s, i) - local b = s:byte(i) + local b = s:byte(i or 1) if not b then --aegisub.debug.out(3, "unicode.charwidth of '%s' @ %d, nil byte\n", s, i) -- FIXME, something in karaskel results in this case, shouldn't happen diff --git a/automation/include/utils-auto4.lua b/automation/include/utils-auto4.lua index 57eb459b1..f8d9980ae 100644 --- a/automation/include/utils-auto4.lua +++ b/automation/include/utils-auto4.lua @@ -107,13 +107,13 @@ end -- Create an alpha override code from a style definition colour code function alpha_from_style(scolor) local r, g, b, a = extract_color(scolor) - return ass_alpha(a) + return ass_alpha(a or 0) end -- Create an colour override code from a style definition colour code function color_from_style(scolor) local r, g, b = extract_color(scolor) - return ass_color(r, g, b) + return ass_color(r or 0, g or 0, b or 0) end -- Converts HSV (Hue, Saturation, Value) to RGB