Added safety when calling Text_Display methods

- before assigning a buffer (Github #845)
- also fixed a warning form unused arg in Fl_Terminal
This commit is contained in:
Matthias Melcher 2023-11-23 15:16:27 +01:00
parent de2dd0cddf
commit b6be421a1f
2 changed files with 2 additions and 2 deletions

View File

@ -455,7 +455,7 @@ protected:
void sgr_italic(bool val) { attrib_ = onoff(val, Fl_Terminal::ITALIC); } // e.g. ESC[3m
void sgr_underline(bool val) { attrib_ = onoff(val, Fl_Terminal::UNDERLINE); } // e.g. ESC[3m
void sgr_dbl_under(bool val) { attrib_ = onoff(val, Fl_Terminal::UNDERLINE); } // e.g. ESC[21m (TODO!)
void sgr_blink(bool val) { /* NOT IMPLEMENTED */ } // e.g. ESC[5m
void sgr_blink(bool val) { (void)val; /* NOT IMPLEMENTED */ } // e.g. ESC[5m
void sgr_inverse(bool val) { attrib_ = onoff(val, Fl_Terminal::INVERSE); } // e.g. ESC[7m
void sgr_strike(bool val) { attrib_ = onoff(val, Fl_Terminal::STRIKEOUT); } // e.g. ESC[9m
};

View File

@ -1861,7 +1861,7 @@ int Fl_Text_Display::get_absolute_top_line_number() const {
Does nothing if the absolute top line number is not being maintained.
*/
void Fl_Text_Display::absolute_top_line_number(int oldFirstChar) {
if (maintaining_absolute_top_line_number()) {
if (maintaining_absolute_top_line_number() && buffer()) {
if (mFirstChar < oldFirstChar)
mAbsTopLineNum -= buffer()->count_lines(mFirstChar, oldFirstChar);
else