Skip to content

Commit

Permalink
Catch potential NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
AnaelMobilia committed May 1, 2019
1 parent 191e461 commit f30cecc
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion app/src/main/java/com/pcinpact/ArticleActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.ShareActionProvider;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
Expand Down Expand Up @@ -72,7 +73,17 @@ public void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_article);

// ID de l'article concerné
articleID = getIntent().getExtras().getInt("ARTICLE_ID");
try {
articleID = getIntent().getExtras().getInt("ARTICLE_ID");
} catch (NullPointerException e) {
// DEBUG
if (Constantes.DEBUG) {
Log.e("ArticleActivity", "onCreate() - Récupération ID article de l'intent", e);
}

// Arrêt de l'activité
this.finish();
}

// Lien sur BDD
monDAO = DAO.getInstance(getApplicationContext());
Expand Down

0 comments on commit f30cecc

Please sign in to comment.