Skip to content

Commit a13fd41

Browse files
committed
Ensure that ColorPicker does not crash on empty string.
Fix: 117302644 Test: Manual. On the create managed profile screen, click "Select provisioning parameters", beside "Color" click "SELECT", click "#ffffffff", empty the text field, click "UPDATE". Expect that it will not crash. Change-Id: Id6a290cec83d24c4e8cd0d7f9e4e45f5d78242e2
1 parent 211a1a1 commit a13fd41

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

app/src/main/java/com/afwsamples/testdpc/common/ColorPicker.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,15 @@ public interface OnColorSelectListener {
202202
*/
203203
@Override
204204
public void onClick(View view) {
205+
final String color = mColorValue.getText().toString();
206+
207+
if (color.isEmpty()) {
208+
Toast.makeText(getActivity(), R.string.not_valid_color, Toast.LENGTH_SHORT).show();
209+
return;
210+
}
211+
205212
try {
206-
mCurrentColor = Color.parseColor(mColorValue.getText().toString());
213+
mCurrentColor = Color.parseColor(color);
207214
updateViewsColor();
208215
} catch (IllegalArgumentException e) {
209216
Toast.makeText(getActivity(), R.string.not_valid_color, Toast.LENGTH_SHORT).show();

0 commit comments

Comments
 (0)