Skip to content

Commit

Permalink
fix(core): check crash on config SetScaleFactor (#3967)
Browse files Browse the repository at this point in the history
  • Loading branch information
etkmao authored and zealotchen0 committed Nov 5, 2024
1 parent fc11e02 commit 4cb7bc1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dom/src/dom/taitank_layout_node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,9 @@ void TaitankLayoutNode::SetPosition(Edge edge, float position) {
void TaitankLayoutNode::SetScaleFactor(float sacle_factor) {
assert(engine_node_ != nullptr);
TaitankConfigRef config = engine_node_->GetConfig();
config->SetScaleFactor(sacle_factor);
if (config) {
config->SetScaleFactor(sacle_factor);
}
}

void TaitankLayoutNode::SetMaxWidth(float max_width) {
Expand Down Expand Up @@ -821,6 +823,7 @@ void TaitankLayoutNode::Allocate() { engine_node_ = new TaitankNode(); }
void TaitankLayoutNode::Deallocate() {
if (engine_node_ == nullptr) return;
delete engine_node_;
engine_node_ = nullptr;
}

void InitLayoutConsts() {
Expand Down

0 comments on commit 4cb7bc1

Please sign in to comment.