Fix vertical tab crashes on enabling/disabling pin tab feature

Fix #16033, close #16034
This commit is contained in:
Don Ho 2025-01-08 17:22:44 +01:00
parent 4b637b4fc8
commit d9d7c4fbb3
2 changed files with 6 additions and 3 deletions

View File

@ -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();
}

View File

@ -1522,16 +1522,16 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT* pDrawItemStruct, bool isDarkMode)
}
// draw pin button
if (_drawTabPinButton && _hPinBtnImgLst != nullptr)
Buffer* buf = reinterpret_cast<Buffer*>(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<Buffer*>(tci.lParam)->isPinned();
bool isPinned = buf->isPinned();
int idxPinImg = _unpinnedIdx; // current: upinned as default
if (isPinned)
{
if (!isSelected) // inactive