/soc/2012/michael/android: 182c1aa8e531: Fixed blist node getter...
Michael Zangl
michael at soc.pidgin.im
Wed Jul 25 07:23:38 EDT 2012
Changeset: 182c1aa8e531c317b6d74ba1e4aeb3454463aea7
Author: Michael Zangl <michael at soc.pidgin.im>
Date: 2012-07-21 12:08 +0200
Branch: soc.2012.android
URL: http://hg.pidgin.im/soc/2012/michael/android/rev/182c1aa8e531
Description:
Fixed blist node getters that return null to not create peers.
diffstat:
android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/blist/PurpleBlistNode.java | 13 ++++++++-
1 files changed, 11 insertions(+), 2 deletions(-)
diffs (37 lines):
diff --git a/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/blist/PurpleBlistNode.java b/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/blist/PurpleBlistNode.java
--- a/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/blist/PurpleBlistNode.java
+++ b/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/blist/PurpleBlistNode.java
@@ -13,7 +13,8 @@ import java.util.Iterator;
* @author michaelz
*
*/
-public class PurpleBlistNode extends PeeredPurpleManaged implements Iterable<PurpleBlistNode> {
+public class PurpleBlistNode extends PeeredPurpleManaged implements
+ Iterable<PurpleBlistNode> {
protected PurpleBlistNode(long nativePointer, CoreManager manager) {
super(nativePointer, manager);
@@ -35,6 +36,9 @@ public class PurpleBlistNode extends Pee
public static PurpleBlistNode constructNode(long nativePointer,
CoreManager manager) {
+ if (nativePointer == 0) {
+ throw new NullPointerException();
+ }
int type = getTypeFor_native(nativePointer);
switch (type) {
case BlistConstants.PURPLE_BLIST_BUDDY_NODE:
@@ -53,7 +57,12 @@ public class PurpleBlistNode extends Pee
private PurpleBlistNode getNode(long nativePointer) {
// TODO: Cache java objects
- return constructNode(nativePointer, getManager());
+
+ if (nativePointer == 0) {
+ return null;
+ } else {
+ return constructNode(nativePointer, getManager());
+ }
}
public PurpleBlistNode getNextSibling() {
More information about the Commits
mailing list