From 4b958d852b98dd4afc354c687c1ee34c9f541ce8 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 (flutter/engine#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 --- engine/src/flutter/flow/layers/transform_layer.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/engine/src/flutter/flow/layers/transform_layer.cc b/engine/src/flutter/flow/layers/transform_layer.cc index c56e5f81bd..f0a925dcd2 100644 --- a/engine/src/flutter/flow/layers/transform_layer.cc +++ b/engine/src/flutter/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;