Fix crash while uploading image with whitespace title (#1636)

This commit is contained in:
Vivek Maskara 2018-06-19 13:23:26 +05:30 committed by Josephine Lim
parent 1dc0a7c257
commit 18b0517fc7

View file

@ -74,13 +74,13 @@ public class SingleUploadFragment extends CommonsDaggerSupportFragment {
//What happens when the 'submit' icon is tapped //What happens when the 'submit' icon is tapped
case R.id.menu_upload_single: case R.id.menu_upload_single:
if (titleEdit.getText().toString().isEmpty()) { if (titleEdit.getText().toString().trim().isEmpty()) {
Toast.makeText(getContext(), R.string.add_title_toast, Toast.LENGTH_LONG).show(); Toast.makeText(getContext(), R.string.add_title_toast, Toast.LENGTH_LONG).show();
return false; return false;
} }
String title = titleEdit.getText().toString(); String title = titleEdit.getText().toString().trim();
String desc = descEdit.getText().toString(); String desc = descEdit.getText().toString().trim();
//Save the title/desc in short-lived cache so next time this fragment is loaded, we can access these //Save the title/desc in short-lived cache so next time this fragment is loaded, we can access these
prefs.edit() prefs.edit()