OSDN Git Service

T28117
[everclip/source.git] / workspace / EverClip / src / com / yuji / ec / task / NoteTypeListTask.java
index 6193298..c16515e 100644 (file)
@@ -13,13 +13,13 @@ import com.yuji.ec.utility.EvernoteUtil;
 
 public class NoteTypeListTask implements AsyncTaskIF {
        private EvernoteUtil util = EvernoteUtil.getInstance();
-       //private NoteList noteList;
+       // private NoteList noteList;
        private WeakReference<NoteTypeListActivity> activityRef;
        private EvernoteUtil.Error errorCode = null;
 
        private List<INoteItem> list = null;
        private int noteItemType;
-       
+
        public NoteTypeListTask(NoteTypeListActivity activity, int noteItemType) {
                activityRef = new WeakReference<NoteTypeListActivity>(activity);
                this.noteItemType = noteItemType;
@@ -29,14 +29,18 @@ public class NoteTypeListTask implements AsyncTaskIF {
                synchronized (util) {
                        try {
                                EvernoteUtil util = EvernoteUtil.getInstance();
-                               switch (noteItemType){
+                               switch (noteItemType) {
                                case Constant.NOTE_ITEM_TYPE_NOTE_BOOK:
                                        List<Notebook> noteList = util.getNoteBookList();
-                                       list = util.toNoteItemFromNoteBook(noteList);
+                                       if (noteList != null) {
+                                               list = util.toNoteItemFromNoteBook(noteList);
+                                       }
                                        break;
                                case Constant.NOTE_ITEM_TYPE_TAG:
                                        List<Tag> tagList = util.getTagList();
-                                       list = util.toNoteItemFromTag(tagList);
+                                       if (tagList != null) {
+                                               list = util.toNoteItemFromTag(tagList);
+                                       }
                                        break;
                                default:
                                        break;
@@ -63,9 +67,9 @@ public class NoteTypeListTask implements AsyncTaskIF {
                return 0;
        }
 
-//     public NoteList getNoteList() {
-//             return noteList;
-//     }
+       // public NoteList getNoteList() {
+       // return noteList;
+       // }
 
        public EvernoteUtil.Error getErrorCode() {
                return errorCode;