From f1d821d8fde79569f801cb9c902c2e9d45b46fb6 Mon Sep 17 00:00:00 2001 From: liyuqian Date: Thu, 13 Jun 2019 09:35:54 -0700 Subject: [PATCH] Set identity instead of crash in opt build (#9262) According to https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#expectations-around-potential-crashes-in-the-engine This should address https://github.com/flutter/flutter/issues/31650#issuecomment-494935507 We'll instead use `FML_LOG(ERROR)` to report errors to our CI tests. See https://github.com/flutter/flutter/issues/34194 --- flow/layers/transform_layer.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flow/layers/transform_layer.cc b/flow/layers/transform_layer.cc index c56e5f81bdd49..f0a925dcd2f50 100644 --- a/flow/layers/transform_layer.cc +++ b/flow/layers/transform_layer.cc @@ -17,7 +17,11 @@ TransformLayer::TransformLayer(const SkMatrix& transform) // // We have to write this flaky test because there is no reliable way to test // whether a variable is initialized or not in C++. - FML_CHECK(transform_.isFinite()); + FML_DCHECK(transform_.isFinite()); + if (!transform_.isFinite()) { + FML_LOG(ERROR) << "TransformLayer is constructed with an invalid matrix."; + transform_.setIdentity(); + } } TransformLayer::~TransformLayer() = default;