Skip to content
This repository has been archived by the owner on Sep 28, 2024. It is now read-only.

Node.toggleGroup NPE in 1.7.1 #296

Closed
ykrasik opened this issue Apr 11, 2017 · 4 comments
Closed

Node.toggleGroup NPE in 1.7.1 #296

ykrasik opened this issue Apr 11, 2017 · 4 comments

Comments

@ykrasik
Copy link

ykrasik commented Apr 11, 2017

This started happening as of 1.7.1
By looking at the code -

fun Node.togglebutton(text: String = "", group: ToggleGroup? = getToggleGroup(), selectFirst: Boolean = true, op: (ToggleButton.() -> Unit)? = null) =
        opcr(this, ToggleButton(text).apply {
            if (group != null) toggleGroup = group
            if (toggleGroup.selectedToggle == null && selectFirst) isSelected = true
        }, op)

if (group != null) toggleGroup = group will assign a toggleGroup if it is given as input, but if it isn't (defaults to null) - the next line if (toggleGroup.selectedToggle... will produce a NPE

@edvin
Copy link
Owner

edvin commented Apr 11, 2017

Hi! Sorry about that. I have committed a fix. Does it work for you now? If not, can you post the code that fails?

@ykrasik
Copy link
Author

ykrasik commented Apr 11, 2017

I'm sorry, but I can't test it unless you release it to maven, I don't have a local clone :) The fix you committed seems correct though, I'm just waiting for the artifact now.

@edvin
Copy link
Owner

edvin commented Apr 11, 2017

@ykrasik
Copy link
Author

ykrasik commented Apr 11, 2017

Confirmed working, thank you!

@ykrasik ykrasik closed this as completed Apr 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants