Add assert(this != &rule) in Rule::CopyFrom().
It does not make any sense to copy a Rule object onto itself.
R=rouslan@chromium.org
BUG=
Review URL: https://codereview.appspot.com/115150043
git-svn-id: http://libaddressinput.googlecode.com/svn/trunk@313 38ededc0-08b8-5190-f2ac-b31f878777ad
diff --git a/cpp/src/rule.cc b/cpp/src/rule.cc
index a6fd9b5..7ab84e5 100644
--- a/cpp/src/rule.cc
+++ b/cpp/src/rule.cc
@@ -14,6 +14,7 @@
#include "rule.h"
+#include <cassert>
#include <cstddef>
#include <map>
#include <string>
@@ -137,6 +138,7 @@
}
void Rule::CopyFrom(const Rule& rule) {
+ assert(this != &rule);
id_ = rule.id_;
format_ = rule.format_;
latin_format_ = rule.latin_format_;