forked from GitHub/gf-core
make sure that the app doesn't crash even if nonExist is used somewhere in the grammars
This commit is contained in:
@@ -313,12 +313,18 @@ public class Translator {
|
|||||||
output = translateByLookup(input);
|
output = translateByLookup(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (output == null)
|
||||||
|
output = "% "; // make sure that we return something
|
||||||
|
|
||||||
return new Pair<String,List<ExprProb>>(output, exprs);
|
return new Pair<String,List<ExprProb>>(output, exprs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String linearize(Expr expr) {
|
public String linearize(Expr expr) {
|
||||||
Concr targetLang = getTargetConcr();
|
Concr targetLang = getTargetConcr();
|
||||||
return targetLang.linearize(expr);
|
String s = targetLang.linearize(expr);
|
||||||
|
if (s == null)
|
||||||
|
s = "% "; // make sure that we return something
|
||||||
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object[] bracketedLinearize(Expr expr) {
|
public Object[] bracketedLinearize(Expr expr) {
|
||||||
|
|||||||
Reference in New Issue
Block a user