Skip to content

Commit 04a2f5c

Browse files
committed
Avoid crash if attempting to access graphical viewer moder when running in curses (text only)
1 parent b31d0e3 commit 04a2f5c

File tree

5 files changed

+37
-1
lines changed

5 files changed

+37
-1
lines changed

cpiface/cpidots.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,15 @@ static void dotSetMode(void)
447447
plPrepareDotsScr();
448448
}
449449

450+
static int dotCan (struct cpifaceSessionAPI_t *cpifaceSession)
451+
{
452+
if (cpifaceSession->console->VidType == vidNorm)
453+
{
454+
return 0;
455+
}
456+
return 1;
457+
}
458+
450459
static int dotIProcessKey (struct cpifaceSessionAPI_t *cpifaceSession, uint16_t key)
451460
{
452461
switch (key)
@@ -464,8 +473,13 @@ static int dotIProcessKey (struct cpifaceSessionAPI_t *cpifaceSession, uint16_t
464473
return 1;
465474
}
466475

467-
static int plDotsEvent (struct cpifaceSessionAPI_t *cpifaceSession, int ignore)
476+
static int plDotsEvent (struct cpifaceSessionAPI_t *cpifaceSession, int ev)
468477
{
478+
switch (ev)
479+
{
480+
case cpievInit:
481+
return dotCan (cpifaceSession);
482+
}
469483
return 1;
470484
}
471485

cpiface/cpigraph.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,8 +623,14 @@ static void strDraw (struct cpifaceSessionAPI_t *cpifaceSession)
623623

624624
static int strCan (struct cpifaceSessionAPI_t *cpifaceSession)
625625
{
626+
if (cpifaceSession->console->VidType == vidNorm)
627+
{
628+
return 0;
629+
}
626630
if ((!cpifaceSession->GetLChanSample) && (!cpifaceSession->GetMasterSample))
631+
{
627632
return 0;
633+
}
628634
return 1;
629635
}
630636

cpiface/cpikube.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,10 @@ static int wuerfelEvent (struct cpifaceSessionAPI_t *cpifaceSession, int ev)
533533
/* fprintf(stderr, __FILE__ ": no wuerfel animations found\n"); */
534534
return 0;
535535
}
536+
if (!vga13)
537+
{
538+
return 0;
539+
}
536540
return 1;
537541
case cpievDoneAll:
538542
plCloseWuerfel();

cpiface/cpiphase.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,14 @@ static void scoSetMode (struct cpifaceSessionAPI_t *cpifaceSession)
415415

416416
static int scoCan (struct cpifaceSessionAPI_t *cpifaceSession)
417417
{
418+
if (cpifaceSession->console->VidType == vidNorm)
419+
{
420+
return 0;
421+
}
418422
if (!cpifaceSession->GetLChanSample && !cpifaceSession->GetPChanSample && (!cpifaceSession->GetMasterSample))
423+
{
419424
return 0;
425+
}
420426
return 1;
421427
}
422428

cpiface/cpiscope.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,8 +475,14 @@ static void scoSetMode (struct cpifaceSessionAPI_t *cpifaceSession)
475475

476476
static int scoCan (struct cpifaceSessionAPI_t *cpifaceSession)
477477
{
478+
if (cpifaceSession->console->VidType == vidNorm)
479+
{
480+
return 0;
481+
}
478482
if ((!cpifaceSession->GetLChanSample) && (!cpifaceSession->GetPChanSample) && (!cpifaceSession->GetMasterSample))
483+
{
479484
return 0;
485+
}
480486
return 1;
481487
}
482488

0 commit comments

Comments
 (0)