Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2713)

Unified Diff: base/values.cc

Issue 7646032: base: Add DCHECK that double Values are finite. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge; unrelated libcros failures Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/values.cc
diff --git a/base/values.cc b/base/values.cc
index 7a364bd8ff0f14402dac1ff80b5f6b72b656a9d2..d3f0f922db51ad6ec38e11830a6237a62f373da5 100644
--- a/base/values.cc
+++ b/base/values.cc
@@ -4,6 +4,7 @@
#include "base/values.h"
+#include "base/float_util.h"
#include "base/logging.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
@@ -160,6 +161,8 @@ FundamentalValue::FundamentalValue(int in_value)
FundamentalValue::FundamentalValue(double in_value)
: Value(TYPE_DOUBLE), double_value_(in_value) {
+ // JSON doesn't support NaN or positive or negative infinity.
+ DCHECK(IsFinite(in_value));
}
FundamentalValue::~FundamentalValue() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698