mirror of
https://github.com/vale981/tdesktop
synced 2025-03-06 02:01:40 -05:00
Fix crash in markdown preprocessing.
This commit is contained in:
parent
556f75ef6c
commit
54cd55523b
1 changed files with 4 additions and 3 deletions
|
@ -426,10 +426,11 @@ private:
|
||||||
int newlinePosition(const QString &text, int offset) const {
|
int newlinePosition(const QString &text, int offset) const {
|
||||||
const auto length = text.size();
|
const auto length = text.size();
|
||||||
if (offset < length) {
|
if (offset < length) {
|
||||||
auto ch = text.data() + offset;
|
const auto begin = text.data();
|
||||||
for (const auto e = ch + length; ch != e; ++ch) {
|
const auto end = begin + length;
|
||||||
|
for (auto ch = begin + offset; ch != end; ++ch) {
|
||||||
if (IsNewline(*ch)) {
|
if (IsNewline(*ch)) {
|
||||||
return (ch - text.data());
|
return (ch - begin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue