From 698aa1aac0a15eeeb0baab67862d67675d2ad029 Mon Sep 17 00:00:00 2001
From: Michel Pollet <buserror@gmail.com>
Date: Tue, 15 Sep 2015 14:34:29 +0100
Subject: [PATCH] ioport: Don't crash if core defition is incomplete

This is not something that happends on existing cores, but can be
annoying when defining a new one.

Signed-off-by: Michel Pollet <buserror@gmail.com>
---
 simavr/sim/avr_ioport.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/simavr/sim/avr_ioport.c b/simavr/sim/avr_ioport.c
index 14fabce..edbdf50 100644
--- a/simavr/sim/avr_ioport.c
+++ b/simavr/sim/avr_ioport.c
@@ -247,6 +247,10 @@ static	avr_io_t	_io = {
 
 void avr_ioport_init(avr_t * avr, avr_ioport_t * p)
 {
+	if (!p->r_port) {
+		printf("skipping PORT%c for core %s\n", p->name, avr->mmcu);
+		return;
+	}
 	p->io = _io;
 //	printf("%s PIN%c 0x%02x DDR%c 0x%02x PORT%c 0x%02x\n", __FUNCTION__,
 //		p->name, p->r_pin,
-- 
2.39.5