diff --git a/PowerEditor/src/ScintillaComponent/DocTabView.cpp b/PowerEditor/src/ScintillaComponent/DocTabView.cpp index 4aff0d42a..1d615dc80 100644 --- a/PowerEditor/src/ScintillaComponent/DocTabView.cpp +++ b/PowerEditor/src/ScintillaComponent/DocTabView.cpp @@ -99,6 +99,9 @@ void DocTabView::setIndividualTabColour(BufferID bufferId, int colorId) int DocTabView::getIndividualTabColourId(int tabIndex) { BufferID bufferId = getBufferByIndex(tabIndex); + if (!bufferId) + return -1; + return bufferId->getDocColorId(); } diff --git a/PowerEditor/src/WinControls/TabBar/TabBar.cpp b/PowerEditor/src/WinControls/TabBar/TabBar.cpp index 0a769ae51..6607736e0 100644 --- a/PowerEditor/src/WinControls/TabBar/TabBar.cpp +++ b/PowerEditor/src/WinControls/TabBar/TabBar.cpp @@ -1522,16 +1522,16 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT* pDrawItemStruct, bool isDarkMode) } // draw pin button - if (_drawTabPinButton && _hPinBtnImgLst != nullptr) + Buffer* buf = reinterpret_cast(tci.lParam); + if (_drawTabPinButton && _hPinBtnImgLst != nullptr && buf) { // Each tab combined with the following stats : // (active / inactive) | (pinned / unpinned) | (hover / not hover / pushed) - bool isPinned = reinterpret_cast(tci.lParam)->isPinned(); + bool isPinned = buf->isPinned(); int idxPinImg = _unpinnedIdx; // current: upinned as default - if (isPinned) { if (!isSelected) // inactive