当我找到答案时,我会狠狠地揍自己一顿,但我很困惑,所以:
我得到一份工作 NullPointerException
尝试访问onedrive时(某些)用户报告。当然我自己不能复制它。我正在使用微软的onedrive sdk。 FileListItem
是我试图填充到 success()
sdk回调的方法。错误的位置来自google play开发者控制台错误详细信息中的堆栈跟踪。
final ICallback<IItemCollectionPage> callback = new ICallback<IItemCollectionPage>() {
@Override
public void success(final IItemCollectionPage result) {
for (Item child : result.getCurrentPage()) {
FileListItem item = new FileListItem();
item.name = child.name;
if (child.parentReference != null) {
item.sourcePath = child.parentReference.path; // java.lang.NullPointerException
}
...
所以 child
来自 for
循环遍历传递给的(可能有效)列表 success()
,它不会撞坏 child.name
,及 child.parentReference != null
.
我的问题是 item
是我刚刚创建的有效对象,并且 child.parentReference != null
,这些用户如何获得 NullPointerException
?
编辑以添加完整堆栈跟踪:
java.lang.NullPointerException:
at [myapp].OneDriveProvider$4.success (OneDriveProvider.java:183)
at [myapp].OneDriveProvider$4.success (OneDriveProvider.java:176)
at com.onedrive.sdk.concurrency.DefaultExecutors$1.run (DefaultExecutors.java:88)
at com.onedrive.sdk.concurrency.SynchronousExecutor$1.onPostExecute (SynchronousExecutor.java:54)
at com.onedrive.sdk.concurrency.SynchronousExecutor$1.onPostExecute (SynchronousExecutor.java:46)
at android.os.AsyncTask.finish (AsyncTask.java:755)
at android.os.AsyncTask.access$900 (AsyncTask.java:192)
at android.os.AsyncTask$InternalHandler.handleMessage (AsyncTask.java:772)
at android.os.Handler.dispatchMessage (Handler.java:107)
at android.os.Looper.loop (Looper.java:214)
at android.app.ActivityThread.main (ActivityThread.java:7397)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:935)
暂无答案!
目前还没有任何答案,快来回答吧!