Skip to content

fix issue 1603 - NullPointerException on setTitle call#34

Merged
flerda merged 1 commit intoflerda:v2.0.1-devfrom
iniju:v2.0.1-issue-1603
Jan 24, 2013
Merged

fix issue 1603 - NullPointerException on setTitle call#34
flerda merged 1 commit intoflerda:v2.0.1-devfrom
iniju:v2.0.1-issue-1603

Conversation

@iniju
Copy link
Copy Markdown

@iniju iniju commented Jan 23, 2013

I think the problem with this issue is that the command Activity.getActionBar() might return null even for the API levels that support action bar. This commit should guard from this case.

@ghost ghost assigned flerda Jan 23, 2013
@flerda
Copy link
Copy Markdown
Owner

flerda commented Jan 23, 2013

I think the problem is that setTitle is called before setContentView.
Looking at:
http://stackoverflow.com/questions/6867076/getactionbar-returns-null
This happens on API 11 and 12, but not on 13 and above.

This fixes it, but will probably leave the title not set correctly in those cases.

@iniju
Copy link
Copy Markdown
Author

iniju commented Jan 24, 2013

Good insight! I replicated this behaviour. I moved the call right after setContentView and it seems it to work too, but I will leave the null check in Compat for good measure.

@iniju
Copy link
Copy Markdown
Author

iniju commented Jan 24, 2013

The other places in the code where setTitle and setSubtitle are called seem safe (after setContentView)

@flerda
Copy link
Copy Markdown
Owner

flerda commented Jan 24, 2013

Thanks!
Maybe in the long term what we want is to revisit this by making the assumption explicit and checking them.
The checks for the null action bar here might end up hiding a real issue. But let's do it for 2.0.1.

flerda added a commit that referenced this pull request Jan 24, 2013
Issue 1603: NullPointerException on setTitle call
@flerda flerda merged commit 73059d1 into flerda:v2.0.1-dev Jan 24, 2013
flerda added a commit that referenced this pull request May 18, 2013
Cause Card.getQuestion to reload the note.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants