Skip to content
This repository has been archived by the owner on Feb 22, 2021. It is now read-only.

Commit

Permalink
fix npe when adapter is not yet set
Browse files Browse the repository at this point in the history
  • Loading branch information
shuhart committed Sep 19, 2018
1 parent 37c6348 commit f44c362
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Usage
-----

1. Add jcenter() to repositories block in your gradle file.
2. Add `implementation 'com.shuhart.bubblepagerindicator:bubblepagerindicator:1.1.0'` to your dependencies.
2. Add `implementation 'com.shuhart.bubblepagerindicator:bubblepagerindicator:1.1.1'` to your dependencies.
3. Add `BubblePageIndicator` into your layouts or view hierarchy:

```xml
Expand Down
2 changes: 1 addition & 1 deletion bubblepagerindicator/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ext {
siteUrl = 'https://github.com/shuhart/BubblePagerIndicator'
gitUrl = 'https://github.com/shuhart/BubblePagerIndicator.git'

libraryVersion = '1.1.0'
libraryVersion = '1.1.1'

developerId = 'shuhart'
developerName = 'Redrick Shuhart'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public float getRadius() {

@Override
protected int getCount() {
return viewPager.getAdapter().getCount();
return viewPager.getAdapter() == null ? 0 : viewPager.getAdapter().getCount();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;

public class BlankActivity extends AppCompatActivity {
Expand All @@ -13,8 +12,6 @@ public class BlankActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_blank);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

FloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
Expand Down

0 comments on commit f44c362

Please sign in to comment.