Skip to content

Commit

Permalink
[Bug fix] Fixes app crashes when groups or rates comes null from db
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielsclimaco committed Jun 19, 2017
1 parent d54b7e0 commit 1936061
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public GroupController () {

private static HashMap<String, Double> convertToHashMapDouble(String value) {

if (value.length() < 2) return null;

value = value.substring(1, value.length()-1); //remove curly brackets
String[] keyValuePairs = value.split(","); //split the string to creat key-value pairs
HashMap<String, Double> map = new HashMap<>();
Expand All @@ -46,6 +48,8 @@ private static HashMap<String, Double> convertToHashMapDouble(String value) {

private static HashMap<String, Integer> convertToHashMapInt(String value) {

if (value.length() < 2) return null;

value = value.substring(1, value.length()-1); //remove curly brackets
String[] keyValuePairs = value.split(","); //split the string to creat key-value pairs
HashMap<String,Integer> map = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ private String getClassUrl(String url, UserClass userClass, String ownerEmail){
builder.addQueryParameter("passingScore", String.valueOf(userClass.getCutOff()));
builder.addQueryParameter("additionScore", String.valueOf(userClass.getAddition()));
builder.addQueryParameter("password", userClass.getPassword());
builder.addQueryParameter("students", "");
builder.addQueryParameter("numberOfStudentsPerGroup", String.valueOf(userClass.getSizeGroups()));

return builder.build().toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {

@Override
public int getItemCount() {
if (groupses == null) return 0;

return groupses.size()/userClass.getSizeGroups();
}

Expand Down

0 comments on commit 1936061

Please sign in to comment.