Skip to content

Commit

Permalink
fix(core): check crash on config SetScaleFactor
Browse files Browse the repository at this point in the history
  • Loading branch information
etkmao committed Jul 26, 2024
1 parent fa4120a commit fdabbc3
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 @@ -636,7 +636,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 @@ -809,6 +811,7 @@ void TaitankLayoutNode::Allocate() { engine_node_ = new TaitankNode(); }
void TaitankLayoutNode::Deallocate() {
if (engine_node_ == nullptr) return;
delete engine_node_;
engine_node_ = nullptr;
}

std::shared_ptr<LayoutNode> CreateLayoutNode() { return std::make_shared<TaitankLayoutNode>(); }
Expand Down

0 comments on commit fdabbc3

Please sign in to comment.