Fix equals bugs which do not work due to the wrong classes being compared

This commit is contained in:
Wiz
2022-07-06 19:38:39 -04:00
committed by GameCubeGBA
parent cef30890ec
commit dae422923e
5 changed files with 13 additions and 14 deletions
@@ -57,9 +57,7 @@ public abstract class AbstractFridaCommand<T> implements FridaCommand<T> {
@Override @Override
public boolean handle(FridaEvent<?> evt, FridaPendingCommand<?> pending) { public boolean handle(FridaEvent<?> evt, FridaPendingCommand<?> pending) {
if (evt instanceof FridaCommandDoneEvent) { if (evt instanceof FridaCommandDoneEvent) {
if (pending.getCommand().equals(((FridaCommandDoneEvent) evt).getCmd())) { return pending.getCommand().equals(((FridaCommandDoneEvent) evt).getCmd());
return true;
}
} }
return false; return false;
} }
@@ -117,8 +115,9 @@ public abstract class AbstractFridaCommand<T> implements FridaCommand<T> {
} else { } else {
manager.getEventListeners().fire.consoleOutput(object+"\n", 0); manager.getEventListeners().fire.consoleOutput(object+"\n", 0);
} }
if (res.equals("[]")) { if ("[]".equals(res.toString())) {
Msg.error(this, "nothing returned for "+this); Msg.error(this, "nothing returned for "+this);
return;
} }
if (res instanceof JsonArray) { if (res instanceof JsonArray) {
JsonArray arr = (JsonArray) res; JsonArray arr = (JsonArray) res;
@@ -283,7 +283,7 @@ public class FileArchive implements Archive {
return; return;
} }
if (saveAsFile.equals(getFile())) { if (saveAsFile.equals(archiveFile.getFile(false))) {
save(); save();
} }
else { else {
@@ -195,7 +195,7 @@ public abstract class DragNDropTree extends JTree implements Draggable, Droppabl
} }
// This is tree node transferable... // This is tree node transferable...
if (draggedNodes.equals(root)) { if (draggedNodes.length > 0 && draggedNodes[0].equals(root)) {
return false; return false;
} }
@@ -208,8 +208,8 @@ public abstract class DragNDropTree extends JTree implements Draggable, Droppabl
return false; return false;
} }
for (int i = 0; i < draggedNodes.length; i++) { for (ProgramNode draggedNode : draggedNodes) {
if (targetNode.equals(draggedNodes[i])) { if (targetNode.equals(draggedNode)) {
return true; return true;
} }
} }
@@ -221,8 +221,8 @@ public abstract class DragNDropTree extends JTree implements Draggable, Droppabl
return false; return false;
} }
for (int i = 0; i < draggedNodes.length; i++) { for (ProgramNode draggedNode : draggedNodes) {
if (targetNode.isNodeAncestor(draggedNodes[i])) { if (targetNode.isNodeAncestor(draggedNode)) {
return true; return true;
} }
} }
@@ -160,11 +160,11 @@ class EditExternalReferencePanel extends EditReferencePanel {
extLibName.clearModel(); extLibName.clearModel();
extLibName.addItem(Library.UNKNOWN); extLibName.addItem(Library.UNKNOWN);
Arrays.sort(names); Arrays.sort(names);
for (int i = 0; i < names.length; i++) { for (String name : names) {
if (Library.UNKNOWN.equals(extLibName)) { if (Library.UNKNOWN.equals(name)) {
continue; continue;
} }
extLibName.addItem(names[i]); extLibName.addItem(name);
} }
} }
@@ -178,7 +178,7 @@ public class ProgramSelection implements AddressSetView {
*/ */
@Override @Override
public boolean intersects(AddressSetView addrSet) { public boolean intersects(AddressSetView addrSet) {
return addressSet != null ? addressSet.intersects(addrSet) : false; return addressSet != null && addressSet.intersects(addrSet);
} }
/** /**