FIx crash in substring

(cherry picked from commit 3b21c41)
This commit is contained in:
PavelRatushny 2017-07-25 10:42:16 +03:00
parent b92a419fdf
commit 746f5b89dd

View file

@ -216,7 +216,11 @@ public class SendPoiDialogFragment extends DialogFragment {
modifiedItemsOutOfLimit += quantity;
if (!stringModifiedIfExceeded) {
if (pos == 0) {
comment = comment.substring(0, comment.length() - action.length() - 3).concat("; ");
if (comment.length() - action.length() - 3 >= 0) {
comment = comment.substring(0, comment.length() - action.length() - 3).concat("; ");
} else {
comment = comment.substring(0, comment.length() - action.length() - 1).concat("; ");
}
} else {
comment = comment.substring(0, comment.length() - 2).concat("; ");
}