summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/PhotoModule.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/camera/PhotoModule.java')
-rw-r--r--src/com/android/camera/PhotoModule.java39
1 files changed, 33 insertions, 6 deletions
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index 9616961a1..8abeff197 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -3839,7 +3839,13 @@ public class PhotoModule
double focuspos = 0;
String focusStr = input.getText().toString();
if (focusStr.length() > 0) {
- focuspos = Double.parseDouble(focusStr);
+ try {
+ focuspos = Double.parseDouble(focusStr);
+ } catch (NumberFormatException e) {
+ Log.w(TAG, "Input foucspos " + focuspos + " is invalid");
+ focuspos = maxFocusPos + 1f;
+ }
+
} else {
RotateTextToast.makeText(mActivity, "Invalid focus position",
Toast.LENGTH_SHORT).show();
@@ -3978,10 +3984,20 @@ public class PhotoModule
String Rgain = Rinput.getText().toString();
String Ggain = Ginput.getText().toString();
String Bgain = Binput.getText().toString();
+ double Rgainf = -1;
+ double Ggainf = -1;
+ double Bgainf = -1;
if (Rgain.length() > 0 && Ggain.length() > 0 && Bgain.length() > 0) {
- double Rgainf = Double.parseDouble(Rgain);
- double Ggainf = Double.parseDouble(Ggain);
- double Bgainf = Double.parseDouble(Bgain);
+ try {
+ Rgainf = Double.parseDouble(Rgain);
+ Ggainf = Double.parseDouble(Ggain);
+ Bgainf = Double.parseDouble(Bgain);
+ } catch (NumberFormatException e) {
+ Log.w(TAG, "Input RGB gain is invalid");
+ Rgainf = maxGain + 1f;
+ Ggainf = maxGain + 1f;
+ Bgainf = maxGain + 1f;
+ }
String RGBGain = Rgain + "," + Ggain + "," + Bgain;
if (Rgainf <= maxGain && Rgainf >= minGain &&
Ggainf <= maxGain && Ggainf >= minGain &&
@@ -4105,7 +4121,12 @@ public class PhotoModule
double newExpTime = -1;
String expTime = ExpTimeInput.getText().toString();
if (expTime.length() > 0) {
- newExpTime = Double.parseDouble(expTime);
+ try {
+ newExpTime = Double.parseDouble(expTime);
+ } catch (NumberFormatException e) {
+ Log.w(TAG, "Input expTime " + expTime + " is invalid");
+ newExpTime = Double.parseDouble(maxExpTime) + 1f;
+ }
}
if (newExpTime <= Double.parseDouble(maxExpTime) &&
newExpTime >= Double.parseDouble(minExpTime)) {
@@ -4151,7 +4172,13 @@ public class PhotoModule
double newExpTime = -1;
String expTime = ExpTimeInput.getText().toString();
if (expTime.length() > 0) {
- newExpTime = Double.parseDouble(expTime);
+ try {
+ newExpTime = Double.parseDouble(expTime);
+ } catch (NumberFormatException e) {
+ Log.w(TAG, "input newExpTime " + newExpTime + " is invalid");
+ newExpTime = Double.parseDouble(maxExpTime) + 1f;
+ }
+
}
if (newISO <= maxISO && newISO >= minISO &&
newExpTime <= Double.parseDouble(maxExpTime) &&