Clock: fix crash when resources could not be loaded
This commit is contained in:
@@ -30,16 +30,18 @@ TOffscreenView::TOffscreenView(BRect frame, const char *name, short mRadius,
|
|||||||
fHoursRadius(hRadius),
|
fHoursRadius(hRadius),
|
||||||
fMinutesRadius(mRadius),
|
fMinutesRadius(mRadius),
|
||||||
fFace(face),
|
fFace(face),
|
||||||
fShowSeconds(show)
|
fShowSeconds(show),
|
||||||
|
fInner(NULL),
|
||||||
|
fCenter(NULL)
|
||||||
{
|
{
|
||||||
|
for (short i = 0; i <= 8; i++)
|
||||||
|
fClockFace[i] = NULL;
|
||||||
|
|
||||||
status_t error;
|
status_t error;
|
||||||
BResources rsrcs;
|
BResources rsrcs;
|
||||||
error = rsrcs.SetToImage(&&dummy_label);
|
error = rsrcs.SetToImage(&&dummy_label);
|
||||||
dummy_label:
|
dummy_label:
|
||||||
if (error == B_OK) {
|
if (error == B_OK) {
|
||||||
for (short i = 0; i <= 8; i++)
|
|
||||||
fClockFace[i] = NULL;
|
|
||||||
|
|
||||||
size_t len;
|
size_t len;
|
||||||
void *picH;
|
void *picH;
|
||||||
BRect theRect(0, 0, 82, 82);
|
BRect theRect(0, 0, 82, 82);
|
||||||
@@ -114,7 +116,7 @@ TOffscreenView::DrawX()
|
|||||||
ASSERT(Window());
|
ASSERT(Window());
|
||||||
|
|
||||||
if (Window()->Lock()) {
|
if (Window()->Lock()) {
|
||||||
if (fClockFace != NULL)
|
if (fClockFace[fFace] != NULL)
|
||||||
DrawBitmap(fClockFace[fFace], BPoint(0, 0));
|
DrawBitmap(fClockFace[fFace], BPoint(0, 0));
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user