Skip to content

Conversation

@imagejan
Copy link
Member

This fixes the issue reported by @kephale on the forum, where the absence of a style attribute on a File parameter leads to a NullPointerException.

This PR is just a quick fix, the method should probably be rewritten when addressing #333.

This fixes the issue reported by @kephale on the forum, where the absence of a style attribute
on a File parameter leads to a NullPointerException:

https://forum.image.sc/t/error-for-file-type-imagej2-parameter/25585

This commit is a quick fix, it should probably be rewritten when addressing issue #333
@imagejan imagejan requested a review from ctrueden May 14, 2019 08:09
@ctrueden
Copy link
Member

Thanks @imagejan. I am concerned that it is possible for style to ever be null. But certainly, being defensive here is a good thing.

@ctrueden ctrueden merged commit 8e65de4 into master May 16, 2019
@ctrueden ctrueden deleted the fix-style-nullpointerexception branch May 16, 2019 14:44
@imagejan
Copy link
Member Author

@ctrueden wrote:

I am concerned that it is possible for style to ever be null.

From DefaultWidgetModel, it seems that style being null is allowed/considered:

@Override
public boolean isStyle(final String style) {
final String widgetStyle = getItem().getWidgetStyle();
if (widgetStyle == null) return style == null;
for (final String s : widgetStyle.split(",")) {
if (s.equals(style)) return true;
}
return false;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants