Author: ruschein
Date: 2010-02-17 15:18:02 -0800 (Wed, 17 Feb 2010)
New Revision: 19352
Modified:
coreplugins/trunk/browser/src/browser/MultiDataEditAction.java
Log:
Added a couple of sanity checks to prevent division by zero exceptions.
Modified: coreplugins/trunk/browser/src/browser/MultiDataEditAction.java
===================================================================
--- coreplugins/trunk/browser/src/browser/MultiDataEditAction.java
2010-02-17 22:50:51 UTC (rev 19351)
+++ coreplugins/trunk/browser/src/browser/MultiDataEditAction.java
2010-02-17 23:18:02 UTC (rev 19352)
@@ -334,6 +334,13 @@
* values.
*/
private void doubleAction(double input) {
+ // Sanity check:
+ if (action == DIV && input == 0.0) {
+ JOptionPane.showMessageDialog(null, "Division by zero
is invalid!",
+ "Arithmetic Error",
JOptionPane.ERROR_MESSAGE);
+ return;
+ }
+
old_values = new ArrayList(objects.size());
new_values = new ArrayList(objects.size());
@@ -367,6 +374,13 @@
* values.
*/
private void integerAction(int input) {
+ // Sanity check:
+ if (action == DIV && input == 0.0) {
+ JOptionPane.showMessageDialog(null, "Division by zero
is invalid!",
+ "Arithmetic Error",
JOptionPane.ERROR_MESSAGE);
+ return;
+ }
+
old_values = new ArrayList(objects.size());
new_values = new ArrayList(objects.size());
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.