mirror of
https://github.com/konsoletyper/teavm.git
synced 2024-12-03 01:50:07 +08:00
Fix String.contains. Fix crashing in rare cases or improper use of JSO
This commit is contained in:
parent
55e0905518
commit
4b77a5d15f
@ -413,8 +413,9 @@ public class TString extends TObject implements TSerializable, TComparable<TStri
|
||||
}
|
||||
|
||||
public boolean contains(TCharSequence s) {
|
||||
int sz = length() - s.length();
|
||||
outer:
|
||||
for (int i = 0; i < length(); ++i) {
|
||||
for (int i = 0; i < sz; ++i) {
|
||||
for (int j = 0; j < s.length(); ++j) {
|
||||
if (charAt(i + j) != s.charAt(j)) {
|
||||
continue outer;
|
||||
|
@ -58,7 +58,7 @@ class JSValueMarshaller {
|
||||
if (type instanceof ValueType.Object) {
|
||||
String className = ((ValueType.Object) type).getClassName();
|
||||
ClassReader cls = classSource.get(className);
|
||||
if (cls.getAnnotations().get(JSFunctor.class.getName()) != null) {
|
||||
if (cls != null && cls.getAnnotations().get(JSFunctor.class.getName()) != null) {
|
||||
return wrapFunctor(location, var, cls);
|
||||
}
|
||||
}
|
||||
@ -221,7 +221,7 @@ class JSValueMarshaller {
|
||||
if (type instanceof ValueType.Object) {
|
||||
String className = ((ValueType.Object) type).getClassName();
|
||||
ClassReader cls = classSource.get(className);
|
||||
if (cls.getAnnotations().get(JSFunctor.class.getName()) != null) {
|
||||
if (cls != null && cls.getAnnotations().get(JSFunctor.class.getName()) != null) {
|
||||
return unwrapFunctor(location, var, cls);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user