aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorMitchell Foral <unknown>2020-08-21 11:16:50 +1000
committerMitchell Foral <unknown>2020-08-21 11:16:50 +1000
commit1a0589a20247f658d137fa86d2479df6550b1c80 (patch)
treefc1934cf2cfdc5b99ae833fa03d362aac15c4181 /src
parent17663447e1de99e02f10ef52d68823f9ca179074 (diff)
downloadscintilla-mirror-1a0589a20247f658d137fa86d2479df6550b1c80.tar.gz
Bounds checks for setting annotation style.
Diffstat (limited to 'src')
-rw-r--r--src/Document.cxx20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/Document.cxx b/src/Document.cxx
index 8d250b9ab..f4f124887 100644
--- a/src/Document.cxx
+++ b/src/Document.cxx
@@ -2366,10 +2366,12 @@ void Document::AnnotationSetText(Sci::Line line, const char *text) {
}
void Document::AnnotationSetStyle(Sci::Line line, int style) {
- Annotations()->SetStyle(line, style);
- const DocModification mh(SC_MOD_CHANGEANNOTATION, LineStart(line),
- 0, 0, 0, line);
- NotifyModified(mh);
+ if (line >= 0 && line < LinesTotal()) {
+ Annotations()->SetStyle(line, style);
+ const DocModification mh(SC_MOD_CHANGEANNOTATION, LineStart(line),
+ 0, 0, 0, line);
+ NotifyModified(mh);
+ }
}
void Document::AnnotationSetStyles(Sci::Line line, const unsigned char *styles) {
@@ -2406,10 +2408,12 @@ void Document::EOLAnnotationSetText(Sci::Line line, const char *text) {
}
void Document::EOLAnnotationSetStyle(Sci::Line line, int style) {
- EOLAnnotations()->SetStyle(line, style);
- const DocModification mh(SC_MOD_CHANGEEOLANNOTATION, LineStart(line),
- 0, 0, 0, line);
- NotifyModified(mh);
+ if (line >= 0 && line < LinesTotal()) {
+ EOLAnnotations()->SetStyle(line, style);
+ const DocModification mh(SC_MOD_CHANGEEOLANNOTATION, LineStart(line),
+ 0, 0, 0, line);
+ NotifyModified(mh);
+ }
}
void Document::EOLAnnotationClearAll() {