From: Niki Roo Date: Mon, 27 Apr 2020 16:08:14 +0000 (+0200) Subject: potential crash on inforeader X-Git-Url: https://git.nikiroo.be/?a=commitdiff_plain;h=70691e843a5ca80f8cd47bf2cde20ac53c09b2b5;p=nikiroo-utils.git potential crash on inforeader --- diff --git a/supported/InfoReader.java b/supported/InfoReader.java index 1a00ef2..405b28f 100644 --- a/supported/InfoReader.java +++ b/supported/InfoReader.java @@ -259,14 +259,17 @@ public class InfoReader { String value = getLine(in, key, 0); if (value != null && !value.isEmpty()) { value = value.trim().substring(key.length() - 1).trim(); - if (value.startsWith("'") && value.endsWith("'") - || value.startsWith("\"") && value.endsWith("\"")) { + if (value.length() > 1 && // + (value.startsWith("'") && value.endsWith("'") + || value.startsWith("\"") + && value.endsWith("\""))) { value = value.substring(1, value.length() - 1).trim(); } // Some old files ended up with TITLE="'xxxxx'" - if ("TITLE".equals(key)) { - if (value.startsWith("'") && value.endsWith("'")) { + if ("^TITLE=".equals(key)) { + if (value.startsWith("'") && value.endsWith("'") + && value.length() > 1) { value = value.substring(1, value.length() - 1).trim(); } }