Fix for crashing range indexes when variable length is 1
This commit is contained in:
@@ -50,6 +50,7 @@ public struct Variable: Equatable, Resolvable {
|
||||
public func resolve(_ context: Context) throws -> Any? {
|
||||
if (variable.hasPrefix("'") && variable.hasSuffix("'")) || (variable.hasPrefix("\"") && variable.hasSuffix("\"")) {
|
||||
// String literal
|
||||
guard variable.count > 1 else { return "" }
|
||||
return String(variable[variable.index(after: variable.startIndex) ..< variable.index(before: variable.endIndex)])
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user