about summary refs log tree commit diff stats
path: root/025compare.cc
diff options
context:
space:
mode:
Diffstat (limited to '025compare.cc')
-rw-r--r--025compare.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/025compare.cc b/025compare.cc
index 92878208..e12fa1dc 100644
--- a/025compare.cc
+++ b/025compare.cc
@@ -32,6 +32,10 @@ case EQUAL: {
   vector<double>& exemplar = ingredients.at(0);
   bool result = true;
   for (int i = /*skip exemplar*/1;  i < SIZE(ingredients);  ++i) {
+    if (SIZE(ingredients.at(i)) != SIZE(exemplar)) {
+      result = false;
+      break;
+    }
     if (!equal(ingredients.at(i).begin(), ingredients.at(i).end(), exemplar.begin())) {
       result = false;
       break;
@@ -103,6 +107,10 @@ case NOT_EQUAL: {
 case NOT_EQUAL: {
   vector<double>& exemplar = ingredients.at(0);
   products.resize(1);
+  if (SIZE(ingredients.at(1)) != SIZE(exemplar)) {
+    products.at(0).push_back(true);
+    break;
+  }
   bool equal_ingredients = equal(ingredients.at(1).begin(), ingredients.at(1).end(), exemplar.begin());
   products.at(0).push_back(!equal_ingredients);
   break;