summaryrefslogtreecommitdiff
path: root/src/fontloader/misc/fontloader-l-string.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2017-01-29 21:01:24 +0100
committerGitHub <noreply@github.com>2017-01-29 21:01:24 +0100
commitc6a32f887d4084f0c3bde51fda4a737b51d1eb06 (patch)
treea01850c3a3562d496bda1675c4f7da6453524597 /src/fontloader/misc/fontloader-l-string.lua
parent98656f9d5ca25aaea2e977b79e09c9bb661f4cef (diff)
parent616b9077567fd670341696cb6ff2bfc71cf691a9 (diff)
downloadluaotfload-c6a32f887d4084f0c3bde51fda4a737b51d1eb06.tar.gz
Merge pull request #395 from phi-gamma/master
v2.8
Diffstat (limited to 'src/fontloader/misc/fontloader-l-string.lua')
-rw-r--r--src/fontloader/misc/fontloader-l-string.lua12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/fontloader/misc/fontloader-l-string.lua b/src/fontloader/misc/fontloader-l-string.lua
index 88297f2..be8f397 100644
--- a/src/fontloader/misc/fontloader-l-string.lua
+++ b/src/fontloader/misc/fontloader-l-string.lua
@@ -75,19 +75,19 @@ local collapser = patterns.collapser
local longtostring = patterns.longtostring
function string.strip(str)
- return lpegmatch(stripper,str) or ""
+ return str and lpegmatch(stripper,str) or ""
end
function string.fullstrip(str)
- return lpegmatch(fullstripper,str) or ""
+ return str and lpegmatch(fullstripper,str) or ""
end
function string.collapsespaces(str)
- return lpegmatch(collapser,str) or ""
+ return str and lpegmatch(collapser,str) or ""
end
function string.longtostring(str)
- return lpegmatch(longtostring,str) or ""
+ return str and lpegmatch(longtostring,str) or ""
end
-- function string.is_empty(str)
@@ -99,7 +99,7 @@ local pattern = P(" ")^0 * P(-1) -- maybe also newlines
-- patterns.onlyspaces = pattern
function string.is_empty(str)
- if str == "" then
+ if not str or str == "" then
return true
else
return lpegmatch(pattern,str) and true or false
@@ -163,7 +163,7 @@ function string.escapedpattern(str,simple)
end
function string.topattern(str,lowercase,strict)
- if str=="" or type(str) ~= "string" then
+ if str == "" or type(str) ~= "string" then
return ".*"
elseif strict then
str = lpegmatch(pattern_c,str)