sc/source/ui/view/tabvwshe.cxx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
New commits: commit 40881e7dbd192994d3d32cd312068e960d9ee275 Author: Gülşah Köse <[email protected]> AuthorDate: Fri Nov 21 18:10:23 2025 +0300 Commit: Gülşah Köse <[email protected]> CommitDate: Thu Nov 27 09:42:59 2025 +0100 cool#13543 Fix the empty hyperlink issue Using EE_TEXTPOS_MAX is safer than GetSelectionText().length in case we have trailing spaces at the end of the string. Signed-off-by: Gülşah Köse <[email protected]> Change-Id: I09cc55d317f741cb092dd225480a66093ac99286 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194342 Tested-by: Caolán McNamara <[email protected]> Code-Style: Caolán McNamara <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> diff --git a/sc/source/ui/view/tabvwshe.cxx b/sc/source/ui/view/tabvwshe.cxx index c0e2372908be..36b6141ee6bc 100644 --- a/sc/source/ui/view/tabvwshe.cxx +++ b/sc/source/ui/view/tabvwshe.cxx @@ -173,7 +173,7 @@ void ScTabViewShell::InsertURLField( const OUString& rName, const OUString& rURL bool bSelectFirst = false; bool bIsEditMode = pScMod->IsEditMode(); int nSelInd = 1; - OUString sSeltext(GetSelectionText()); + bool bHasText = !GetSelectionText().isEmpty(); if ( !bIsEditMode ) { @@ -195,9 +195,10 @@ void ScTabViewShell::InsertURLField( const OUString& rName, const OUString& rURL // Check if user selected a whole cell by single click, and cell has content. // tdf#80043 - if true, replace the entire content of the selected cell instead of // inserting a duplicate, or appending the url. - if (!bIsEditMode && !bSelectFirst && pTableView && !sSeltext.isEmpty()) + if (!bIsEditMode && !bSelectFirst && pTableView && bHasText) { - nSelInd = sSeltext.getLength(); + // Using GetSelectionText() length is not safe here in case of cell content has trailing spaces + nSelInd = EE_TEXTPOS_MAX; bSelectFirst = true; }
