Steps to reproduce :

  • Click Q (Ask Question button)
  • Add text to body
  • Press back to exit from the add question view
  • Click Q again
  • Click Resume

The app crashes everytime.

Version: 0.1.19


Version: 0.1.21

  • Thanks for reporting this. When entering the post question screen the first time, is there any value automatically chosen for the site selector or is it blank? – Kasra Rahjerdi Aug 29 '13 at 14:57
  • @KasraRahjerdi The value selected is the site on which I last posted (I think), MSO in this case. – asheeshr Aug 29 '13 at 14:58

This should be fixed in app version 0.1.24 coming out later today.

I wasn't able to get a 100% repro but I was still able to recreate the crash once in a while, I'm no longer seeing it and from what I changed I believe I fixed the race condition that was causing it, so if it is still happening after 0.1.24 please comment and I'll re-open the bug, thanks.

| improve this answer | |

This the reason.

09-05 04:49:26.422: E/AndroidRuntime(937): FATAL EXCEPTION: main
09-05 04:49:26.422: E/AndroidRuntime(937): java.lang.NullPointerException: [v0.1.22] 
09-05 04:49:26.422: E/AndroidRuntime(937):  at com.stackexchange.marvin.ui.question.AskFragment$3.onClick(AskFragment.java:157)

Because there is no data avail to fetch in table QuestionDraft.

new DraftTask(AskFragment.this.getActivity()).getQuestion();

returns null

  public void onClick(DialogInterface paramAnonymousDialogInterface, int paramAnonymousInt)
    PostDraft localPostDraft = new DraftTask(AskFragment.this.getActivity()).getQuestion();
    . . .
    . . .
    . . .

So, why is the developer trying to show us the null value???

Probably he/she forgot to edit the code on production version. Values are not pushed to the DB.

saveDraft(false); should be saveDraft(true);

    public void saveDraft()

    public void saveDraft(boolean paramBoolean)
    if (paramBoolean)
      String str2 = getSelectedSite();
      if (str2 == null)
        str2 = "";
      DatabaseManager.getManager(getActivity()).insertQuestionDraft(getTitle(), getBody(), getTags(), str2);

Chances are there that I might be wrong, since the below code follows without any condition, which inturn calls insertQuestionDraft();

new DraftTask(getActivity()).saveQuestion(getTitle(), getBody(), getTags(), str1);

I would like to know what went wrong, while insertion.

| improve this answer | |
  • Great APKTool or APK2Gold skills :) The issue is that the PostDraft returns null when hitting "Resume" on the dialog, but the whole reason the dialog shows up is a check earlier in the code that says "if a draft exists in the database, show this", and I'm not able to reproduce the crash 100% so I think it's a race condition on writing/reading that I need to track down. – Kasra Rahjerdi Sep 5 '13 at 1:21
  • All credit goes to those devs. I am able to reproduce it every time. My QuestionDraft remains empty, but AnswerDraft gets updated. Probably we have clean Uninstall and retry. Thought QuestionDraft is empty, am shown with dialog for resuming drafts as expected, on click of resume it crashes. – VenomVendor Sep 5 '13 at 3:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .