/soc/2012/michael/android: 433668f42b41: Made Glist converter re...
Michael Zangl
michael at soc.pidgin.im
Sat Jul 7 13:00:48 EDT 2012
Changeset: 433668f42b41cda7f8d5ecf28a34d06218bbed4f
Author: Michael Zangl <michael at soc.pidgin.im>
Date: 2012-07-07 18:58 +0200
Branch: soc.2012.android
URL: http://hg.pidgin.im/soc/2012/michael/android/rev/433668f42b41
Description:
Made Glist converter return an empty list if the given list was null.
diffstat:
android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/glib/GList.java | 18 ++++++---
1 files changed, 12 insertions(+), 6 deletions(-)
diffs (42 lines):
diff --git a/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/glib/GList.java b/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/glib/GList.java
--- a/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/glib/GList.java
+++ b/android/workspace/im.pidgin.libpurple/src/im/pidgin/libpurple/glib/GList.java
@@ -3,17 +3,18 @@
import im.pidgin.libpurple.peering.PeerGenerator;
import java.util.AbstractSequentialList;
+import java.util.Collections;
import java.util.List;
import java.util.ListIterator;
-public class GList<E> extends AbstractSequentialList<E>{
-
+public class GList<E> extends AbstractSequentialList<E> {
+
private final GListReference<E> reference;
protected GList(GListReference<E> reference) {
this.reference = reference;
}
-
+
@Override
public ListIterator<E> listIterator(int location) {
return new GListIterator<E>(reference, location);
@@ -24,8 +25,13 @@
return reference.length();
}
- public static <E> List<E> fromNativeList(long listPointer, PeerGenerator<E> peerGenerator,
- boolean modifyable) {
- return new GList<E>(new GListReference<E>(listPointer, peerGenerator, modifyable));
+ public static <E> List<E> fromNativeList(long listPointer,
+ PeerGenerator<E> peerGenerator, boolean modifyable) {
+ if (listPointer == 0) {
+ return Collections.emptyList();
+ } else {
+ return new GList<E>(new GListReference<E>(listPointer,
+ peerGenerator, modifyable));
+ }
}
}
More information about the Commits
mailing list