Since index is uint, it can causes problems if totalNumberOfCharacters is 0.
Change-Id: I3a815474a42ddea9f02ab1e358f7edf8ec0f8dac
Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
const GlyphInfo* const glyphInfoBuffer = parameters.visualModel->mGlyphs.Begin();
CharacterIndex index;
GlyphMetrics glyphMetrics;
const GlyphInfo* const glyphInfoBuffer = parameters.visualModel->mGlyphs.Begin();
CharacterIndex index;
GlyphMetrics glyphMetrics;
- MetricsPtr& metrics = parameters.metrics;
- GlyphIndex glyphIndex = 0u;
- Length numberOfGlyphs = 0u;
+ MetricsPtr& metrics = parameters.metrics;
+ GlyphIndex glyphIndex = 0u;
+ Length numberOfGlyphs = 0u;
cursorInfo.lineHeight = GetLineHeight(newLine);
cursorInfo.lineHeight = GetLineHeight(newLine);
const Length totalNumberOfCharacters = parameters.logicalModel->mText.Count();
const Length totalNumberOfCharacters = parameters.logicalModel->mText.Count();
- index = totalNumberOfCharacters - 1;
+ if(totalNumberOfCharacters > 0u)
+ {
+ index = totalNumberOfCharacters - 1u;
+ }
GetGlyphMetricsFromCharacterIndex(index, glyphInfoBuffer, charactersToGlyphBuffer, glyphsPerCharacterBuffer, metrics, glyphMetrics, glyphIndex, numberOfGlyphs);
GetGlyphMetricsFromCharacterIndex(index, glyphInfoBuffer, charactersToGlyphBuffer, glyphsPerCharacterBuffer, metrics, glyphMetrics, glyphIndex, numberOfGlyphs);