Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gui): NullPointerException on project save #1464

Merged
merged 3 commits into from
Apr 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

import jadx.api.data.impl.JadxCodeData;

public class ProjectData {

private int projectVersion = 1;
private List<Path> files;
private List<Path> files = new ArrayList<>();
private List<String[]> treeExpansions = new ArrayList<>();
private JadxCodeData codeData = new JadxCodeData();
private List<TabViewState> openTabs = Collections.emptyList();
Expand All @@ -21,7 +22,7 @@ public List<Path> getFiles() {
}

public void setFiles(List<Path> files) {
this.files = files;
this.files = Objects.requireNonNull(files);
}

public List<String[]> getTreeExpansions() {
Expand Down
6 changes: 4 additions & 2 deletions jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
import javax.swing.tree.TreeSelectionModel;

import org.fife.ui.rsyntaxtextarea.Theme;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -178,7 +179,8 @@ public class MainWindow extends JFrame {
private final transient JadxSettings settings;
private final transient CacheObject cacheObject;
private final transient BackgroundExecutor backgroundExecutor;
private transient JadxProject project;
@NotNull
private transient JadxProject project = new JadxProject();
private transient Action newProjectAction;
private transient Action saveProjectAction;

Expand Down Expand Up @@ -516,7 +518,7 @@ private List<Path> openProject(Path path) {
return jadxProject.getFilePaths();
}

public void updateProject(JadxProject jadxProject) {
public void updateProject(@NotNull JadxProject jadxProject) {
jadxProject.setSettings(settings);
jadxProject.setMainWindow(this);
this.project = jadxProject;
Expand Down