Skip to content

Commit

Permalink
nil point dereference in cartridge loading fixed
Browse files Browse the repository at this point in the history
this would be happen when supercharger failed to load due to a missing BIOS file
  • Loading branch information
JetSetIlly committed Jan 29, 2022
1 parent f888f5b commit 720f59c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gui/crt/preferences.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ const (
blackLevel = 0.06
pixelPerfectFade = 0.4
syncSpeedScanlines = 65
syncPowerOn = false
syncPowerOn = true
)

// NewPreferences is the preferred method of initialisation for the Preferences type.
Expand Down
6 changes: 6 additions & 0 deletions hardware/memory/cartridge/cartridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ func (cart *Cartridge) Attach(cartload cartridgeloader.Loader) error {

// log result of Attach() on function return
defer func() {
// we might have arrived here as a result of an error so we should
// check cart.mapper before trying to access it
if cart.mapper == nil {
return
}

if _, ok := cart.mapper.(*ejected); !ok {
logger.Logf("cartridge", "inserted %s", cart.mapper.ID())
}
Expand Down

0 comments on commit 720f59c

Please sign in to comment.