After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 341330 - Add null check for TreeStore.isIterValid()
Add null check for TreeStore.isIterValid()
Status: RESOLVED FIXED
Product: java-gnome
Classification: Bindings
Component: GTK
mainline
Other All
: Normal enhancement
: ---
Assigned To: Adam Jocksch
java-gnome bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2006-05-10 20:41 UTC by Phil Muldoon
Modified: 2007-01-05 00:58 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement



Description Phil Muldoon 2006-05-10 20:41:10 UTC
Right now the bindings just pipe to gtk_tree_store_iter_is_valid:

public boolean isIterValid(TreeIter iter) {
return gtk_tree_store_iter_is_valid(getHandle(), iter.getHandle());
}

However if iter is null, iter.getHandle() will raise an NPE. That requires me to
either:

1) Handle the possible NPE whenever I do an TreeStore.isIterValid()

or 

2) Test for null myself.

Everytime I need to check an TreeIter, right now that requires me to write two
tests. I request that isIterValid do the null test, and return false if null.
(After all I don't care why the TreeIter is invalid, whether it points to
nowhere or is a null, just that it is invalid)
Comment 1 Andrew Cowie 2006-05-11 10:25:24 UTC
Concur. It should return false if the argument is null.

[I suspect we need guards like this all over the bindings. Might as well start here]

AfC
Comment 2 Adam Jocksch 2006-05-11 17:45:07 UTC
I'll make this change and commit it.
Comment 3 Adam Jocksch 2006-05-11 18:19:12 UTC
I've commit this change, along with a paralel one in ListStore.java