Skip to content

Commit c8ac4d5

Browse files
committed
Update TGLabel.cxx
1 parent 7fc66aa commit c8ac4d5

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

gui/gui/src/TGLabel.cxx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ TGLabel::TGLabel(const TGWindow *p, TGString *text, GContext_t norm,
8080
wattr.fMask = kWAWinGravity | kWABitGravity;
8181
wattr.fBitGravity = 5; // center
8282
wattr.fWinGravity = 1;
83-
gVirtualX->ChangeWindowAttributes(fId, &wattr);
83+
if (gVirtualX)
84+
gVirtualX->ChangeWindowAttributes(fId, &wattr);
8485

8586
Resize();
8687
SetWindowName();
@@ -121,7 +122,8 @@ TGLabel::TGLabel(const TGWindow *p, const char *text, GContext_t norm,
121122
wattr.fMask = kWAWinGravity | kWABitGravity;
122123
wattr.fBitGravity = 5; // center
123124
wattr.fWinGravity = 1;
124-
gVirtualX->ChangeWindowAttributes(fId, &wattr);
125+
if (gVirtualX)
126+
gVirtualX->ChangeWindowAttributes(fId, &wattr);
125127

126128
Resize();
127129
SetWindowName();
@@ -257,7 +259,7 @@ void TGLabel::DoRedraw()
257259
DrawText(fNormGC, x, y);
258260
break;
259261
}
260-
} else { // disabled
262+
} else if (gVirtualX) { // disabled
261263
FontH_t fontH;
262264

263265
if (GetDefaultFontStruct() != fFont->GetFontStruct()) {
@@ -438,7 +440,8 @@ void TGLabel::SetTextJustify(Int_t mode)
438440
break;
439441
}
440442

441-
gVirtualX->ChangeWindowAttributes(fId, &wattr);
443+
if (gVirtualX)
444+
gVirtualX->ChangeWindowAttributes(fId, &wattr);
442445

443446
Layout();
444447
}

0 commit comments

Comments
 (0)