mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-28 05:05:38 +00:00
Fixed #1904 NullpointerException when renaming invalid identifiers in AS1/2 files caused by missing charset
This commit is contained in:
@@ -2968,7 +2968,11 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
||||
|
||||
for (ASMSource src : actionsMap.keySet()) {
|
||||
actionsMap.get(src).removeNops();
|
||||
src.setActions(actionsMap.get(src));
|
||||
try {
|
||||
src.setActions(actionsMap.get(src));
|
||||
} catch (ValueTooLargeException vtle) {
|
||||
Logger.getLogger(SWF.class.getName()).log(Level.WARNING, "renaming AS2 identifiers failed for an action source with error: {0}", vtle.getMessage());
|
||||
}
|
||||
src.setModified();
|
||||
}
|
||||
|
||||
|
||||
@@ -93,6 +93,11 @@ public class ActionGraph extends Graph {
|
||||
this.insideDoInitAction = insideDoInitAction;
|
||||
this.insideFunction = insideFunction;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionGraphSource getGraphCode() {
|
||||
return (ActionGraphSource) code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinkedHashMap<String, Graph> getSubGraphs() {
|
||||
@@ -110,7 +115,7 @@ public class ActionGraph extends Graph {
|
||||
outs.add(new ActionList(((ActionGraphSource) code).getCharset()));
|
||||
continue;
|
||||
}
|
||||
outs.add(new ActionList(alist.subList(adr2ip(alist, endAddr), adr2ip(alist, endAddr + size))));
|
||||
outs.add(new ActionList(alist.subList(adr2ip(alist, endAddr), adr2ip(alist, endAddr + size)), getGraphCode().getCharset()));
|
||||
endAddr += size;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ public class ActionGraphSource extends GraphSource {
|
||||
}
|
||||
|
||||
public ActionGraphSource(String path, boolean insideDoInitAction, List<Action> actions, int version, HashMap<Integer, String> registerNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, String charset) {
|
||||
this.actions = actions instanceof ActionList ? (ActionList) actions : new ActionList(actions);
|
||||
this.actions = actions instanceof ActionList ? (ActionList) actions : new ActionList(actions, charset);
|
||||
this.version = version;
|
||||
this.registerNames = registerNames;
|
||||
this.variables = variables;
|
||||
|
||||
@@ -63,8 +63,9 @@ public class ActionList extends ArrayList<Action> {
|
||||
}
|
||||
|
||||
|
||||
public ActionList(Collection<Action> actions) {
|
||||
public ActionList(Collection<Action> actions, String charset) {
|
||||
super(actions);
|
||||
this.charset = charset;
|
||||
}
|
||||
|
||||
public void setActions(List<Action> list) {
|
||||
|
||||
@@ -139,7 +139,7 @@ public class ActionListReader {
|
||||
nextOffsets.put(endAddress, endAddress + 1);
|
||||
}
|
||||
|
||||
ActionList actions = fixActionList(new ActionList(actionMap.values()), nextOffsets);
|
||||
ActionList actions = fixActionList(new ActionList(actionMap.values(), sis.getCharset()), nextOffsets);
|
||||
|
||||
// jump to the entry action when it is diffrent from the first action in the map
|
||||
if (entryAction != actions.get(0)) {
|
||||
|
||||
@@ -597,7 +597,7 @@ public class FastActionList implements Collection<ActionItem> {
|
||||
List<Action> resultList = new ArrayList<>(size);
|
||||
ActionItem item = firstItem;
|
||||
if (item == null) {
|
||||
return new ActionList(resultList);
|
||||
return new ActionList(resultList, charset);
|
||||
}
|
||||
|
||||
do {
|
||||
@@ -605,7 +605,7 @@ public class FastActionList implements Collection<ActionItem> {
|
||||
item = item.next;
|
||||
} while (item != firstItem);
|
||||
|
||||
ActionList result = new ActionList(resultList);
|
||||
ActionList result = new ActionList(resultList, charset);
|
||||
updateActionAddressesAndLengths();
|
||||
updateJumps();
|
||||
updateActionStores();
|
||||
|
||||
Reference in New Issue
Block a user