mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-27 06:19:36 +00:00
Fix bug #8220: tex2lyx crashes on single-character commands
Fix commit [aa9fed93/lyxgit]: it is never a good idea to call substr(4) on a string without checking its length. Moreover, it is even better in this case to check that the first letters are "text" as the reminder of the code assumes...
This commit is contained in:
parent
9466967f0e
commit
2a13b02a94
@ -3573,7 +3573,8 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
|
||||
context.font.language, lang);
|
||||
}
|
||||
|
||||
else if (is_known(t.cs().substr(4, string::npos), polyglossia_languages)) {
|
||||
else if (prefixIs(t.cs(), "text")
|
||||
&& is_known(t.cs().substr(4), polyglossia_languages)) {
|
||||
// scheme is \textLANGUAGE{text} where LANGUAGE is in polyglossia_languages[]
|
||||
string lang;
|
||||
// We have to output the whole command if it has an option
|
||||
|
Loading…
Reference in New Issue
Block a user