diff --git a/app/src/main/java/com/example/cosmosclient/views/SigninActivity.java b/app/src/main/java/com/example/cosmosclient/views/SigninActivity.java index 2a70436..b5b78ae 100644 --- a/app/src/main/java/com/example/cosmosclient/views/SigninActivity.java +++ b/app/src/main/java/com/example/cosmosclient/views/SigninActivity.java @@ -89,19 +89,25 @@ @Override public void onResponse(Call call, Response response) { if (response.isSuccessful()) { - SigninResponse result = response.body(); + if(response.body() == null){ + //パスワードが違う際、アプリが落ちてしまうため + Toast.makeText(SigninActivity.this, + "パスワードが違います",Toast.LENGTH_LONG).show(); + }else{ + SigninResponse result = response.body(); - //app/Cosmosに情報保存 - Cosmos app = (Cosmos)getApplication(); - app.setToken(result.token); - app.setuId(UserIdText.getText().toString()); + //app/Cosmosに情報保存 + Cosmos app = (Cosmos) getApplication(); + app.setToken(result.token); + app.setuId(UserIdText.getText().toString()); - //画面遷移 - Intent intent = new Intent(getApplication(), GroupListActivity.class); - startActivity(intent); - Toast.makeText(SigninActivity.this, - "ログインしました", Toast.LENGTH_SHORT).show(); - finish(); + //画面遷移 + Intent intent = new Intent(getApplication(), GroupListActivity.class); + startActivity(intent); + Toast.makeText(SigninActivity.this, + "ログインしました", Toast.LENGTH_SHORT).show(); + finish(); + } }else{ //onFailureでキャッチできないエラーの処理 @@ -113,7 +119,7 @@ //失敗時 @Override public void onFailure(Call call, Throwable t) { - //t.printStackTrace(); + t.printStackTrace(); Toast.makeText(SigninActivity.this, "ユーザIDもしくはパスワードが間違っています",Toast.LENGTH_SHORT).show(); }