mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-18 13:38:26 +00:00
#284 fixed nullpointer exceptions, texttag
This commit is contained in:
@@ -47,6 +47,9 @@ public class NotCompileTimeAVM2Item extends AVM2Item {
|
||||
|
||||
@Override
|
||||
public GraphTargetItem getThroughNotCompilable() {
|
||||
if(object==null){
|
||||
return object;
|
||||
}
|
||||
return object.getThroughNotCompilable();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1337,6 +1337,13 @@ public class Action implements GraphSourceItem {
|
||||
if (o instanceof Long) {
|
||||
return (Long) o;
|
||||
}
|
||||
if(o instanceof String){
|
||||
try{
|
||||
return Double.parseDouble((String)o);
|
||||
}catch(NumberFormatException nfe){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -128,7 +128,9 @@ public class DefineSpriteTag extends CharacterTag implements Container, BoundedT
|
||||
depthMap.put(pot.getDepth(), charId);
|
||||
characterId = (charId);
|
||||
} else {
|
||||
characterId = (depthMap.get(pot.getDepth()));
|
||||
Integer chi= (depthMap.get(pot.getDepth()));
|
||||
if(chi!=null)
|
||||
characterId = chi;
|
||||
}
|
||||
}
|
||||
if (characterId == -1) {
|
||||
|
||||
@@ -118,7 +118,7 @@ public abstract class TextTag extends CharacterTag implements BoundedTag {
|
||||
textHeight = rec.textHeight;
|
||||
glyphs = font.getGlyphShapeTable();
|
||||
|
||||
if (font.getLeading() == -1) {
|
||||
if (!font.hasLayout()) {
|
||||
String fontName = font.getFontName(tags);
|
||||
if (!availableFonts.contains(fontName)) {
|
||||
fontName = "Times New Roman";
|
||||
@@ -175,7 +175,13 @@ public abstract class TextTag extends CharacterTag implements BoundedTag {
|
||||
updateRect(textBounds, x + rect.Xmin, y + rect.Ymin);
|
||||
updateRect(textBounds, x + rect.Xmax, y + rect.Ymax);
|
||||
int adv = entry.glyphAdvance;
|
||||
int defaultAdvance = 20 * FontTag.getSystemFontAdvance(aFont, font.glyphToChar(tags, entry.glyphIndex));
|
||||
|
||||
int defaultAdvance;
|
||||
if (font.hasLayout()) {
|
||||
defaultAdvance = 20 * (int) Math.round((double) textHeight * font.getGlyphAdvance(entry.glyphIndex) / (font.getDivider() * 1024.0));
|
||||
} else {
|
||||
defaultAdvance = 20 * FontTag.getSystemFontAdvance(aFont, font.glyphToChar(tags, entry.glyphIndex));
|
||||
}
|
||||
letterSpacing = adv - defaultAdvance;
|
||||
x += adv;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user