aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ui/UiHost.cpp3
-rw-r--r--src/ui/render/TextRenderObject.cpp4
2 files changed, 4 insertions, 3 deletions
diff --git a/src/ui/UiHost.cpp b/src/ui/UiHost.cpp
index 09f8fd9b..56ce1eb9 100644
--- a/src/ui/UiHost.cpp
+++ b/src/ui/UiHost.cpp
@@ -365,6 +365,7 @@ void UiHost::UpdateCursor() {
}
Control* UiHost::HitTest(const Point& point) {
- return root_render_object_->HitTest(point)->GetAttachedControl();
+ const auto render_object = root_render_object_->HitTest(point);
+ return render_object ? render_object->GetAttachedControl() : nullptr;
}
} // namespace cru::ui
diff --git a/src/ui/render/TextRenderObject.cpp b/src/ui/render/TextRenderObject.cpp
index 9cae65d6..e0c68683 100644
--- a/src/ui/render/TextRenderObject.cpp
+++ b/src/ui/render/TextRenderObject.cpp
@@ -189,11 +189,11 @@ Size TextRenderObject::OnMeasureContent(const MeasureRequirement& requirement,
log::Warn(
"TextRenderObject: Text actual height exceeds the required max "
"height.");
- result.width = requirement.max.width.GetLengthOrUndefined();
+ result.height = requirement.max.height.GetLengthOrUndefined();
} else {
result.height =
std::max(result.height, preferred_size.height.GetLengthOr0());
- result.width =
+ result.height =
std::max(result.height, requirement.min.height.GetLengthOr0());
}