mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-27 15:54:17 +02:00
Fix vertical tab crashes on enabling/disabling pin tab feature
Fix #16033, close #16034
This commit is contained in:
parent
4b637b4fc8
commit
d9d7c4fbb3
@ -99,6 +99,9 @@ void DocTabView::setIndividualTabColour(BufferID bufferId, int colorId)
|
|||||||
int DocTabView::getIndividualTabColourId(int tabIndex)
|
int DocTabView::getIndividualTabColourId(int tabIndex)
|
||||||
{
|
{
|
||||||
BufferID bufferId = getBufferByIndex(tabIndex);
|
BufferID bufferId = getBufferByIndex(tabIndex);
|
||||||
|
if (!bufferId)
|
||||||
|
return -1;
|
||||||
|
|
||||||
return bufferId->getDocColorId();
|
return bufferId->getDocColorId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1522,16 +1522,16 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT* pDrawItemStruct, bool isDarkMode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// draw pin button
|
// 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 :
|
// Each tab combined with the following stats :
|
||||||
// (active / inactive) | (pinned / unpinned) | (hover / not hover / pushed)
|
// (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
|
int idxPinImg = _unpinnedIdx; // current: upinned as default
|
||||||
|
|
||||||
|
|
||||||
if (isPinned)
|
if (isPinned)
|
||||||
{
|
{
|
||||||
if (!isSelected) // inactive
|
if (!isSelected) // inactive
|
||||||
|
Loading…
x
Reference in New Issue
Block a user