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

FixImagePath NPE on NewMastodonProject from ImageOpenedInImageJ #228

Closed
xulman opened this issue Mar 19, 2023 · 5 comments
Closed

FixImagePath NPE on NewMastodonProject from ImageOpenedInImageJ #228

xulman opened this issue Mar 19, 2023 · 5 comments
Assignees
Labels

Comments

@xulman
Copy link
Contributor

xulman commented Mar 19, 2023

...likely because there exists no project's xml yet

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
	at org.mastodon.mamut.tomancak.DatasetPathDialog.<init>(DatasetPathDialog.java:107)
	at org.mastodon.mamut.tomancak.DatasetPathDialog.<init>(DatasetPathDialog.java:98)
	at org.mastodon.mamut.tomancak.TomancakPlugins.tweakDatasetPath(TomancakPlugins.java:397)
	at org.scijava.ui.behaviour.util.RunnableAction.actionPerformed(RunnableAction.java:47)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)

The c'tor at L107 should be more smarter and test if it has gotten non-null project reference.

And if it got null ref, show a new dialog "sorry, no project yet, please save it first" (or alike) and avoid throwing NPE because indeed the issue is gone after the project is saved (tested myself).

@xulman
Copy link
Contributor Author

xulman commented Mar 19, 2023

(I apparently cannot assign the issue to myself, nor can I give it a label... but I'm okay with that, just FYI)

@tinevez tinevez self-assigned this Mar 19, 2023
@tinevez
Copy link
Contributor

tinevez commented Mar 19, 2023

How do you reproduce this bug? I have no error message when creating a project from an ImagePlus.

@xulman
Copy link
Contributor Author

xulman commented Mar 19, 2023

  1. fresh Fiji
  2. install Mastodon update site
  3. open any TIFF into Fiji
  4. open Mastodon
  5. choose "new Mastodon project", then "use an image opened in ImageJ"
  6. click "create", Mastodon opens normally
  7. click File -> Fix Image Path
  8. NPE comes out...

@tinevez
Copy link
Contributor

tinevez commented Mar 19, 2023

Ahhhhhh I missed the last part.
Indeed:
image

Do you want to work on it?

@tinevez tinevez added bug and removed investigating labels Mar 19, 2023
@xulman
Copy link
Contributor Author

xulman commented Mar 19, 2023

I can....

It breaks here, I would solve it by adding a guarding-test before that line, e.g.,

if (project == null || project.getProjectRoot() == null) {
     code to create a different dialog content -- a content that informs
     that it cannot be fixing a path in a project when there's no project created yet
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants