commit bc0eba99c17eca674012d29df647dee51c5a4756
Author: Koji Yokota <[email protected]>
Date:   Mon Sep 8 23:18:47 2025 +0900

    Initialization can be called before rows are set up
---
 src/frontends/qt/GuiInputMethod.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/frontends/qt/GuiInputMethod.cpp 
b/src/frontends/qt/GuiInputMethod.cpp
index 2c85760a71..ff06c89a53 100644
--- a/src/frontends/qt/GuiInputMethod.cpp
+++ b/src/frontends/qt/GuiInputMethod.cpp
@@ -1051,6 +1051,9 @@ pos_type GuiInputMethod::initializePositions(Cursor * 
cur) {
        //     d->virtual_boundary_ = if the preedits hit the boundary
        // and returns the row index of the starting point of preedits
 
+       if (d->rows_size_ == 0 || d->rows_->empty())
+               return 0;
+
        // position of the real cursor (also the start of the preedit)
        if (cur->top().pos() != d->cur_pos_)
                Q_EMIT cursorPositionChanged();
@@ -1081,7 +1084,7 @@ pos_type GuiInputMethod::initializePositions(Cursor * 
cur) {
 
        // width of first-row preedit string in the case of virtual boundary
        int orphan_width = 0;
-       if (!(d->rows_->empty() || d->rows_[cur_row_idx].empty()) &&
+       if (!d->rows_[cur_row_idx].empty() &&
                d->rows_[cur_row_idx].back().isPreedit())
                orphan_width =
                        horizontalAdvance(d->rows_[cur_row_idx].back().str);
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to