From 58142f4f6b6ed28e818c46a78bbf7e9456b154c7 Mon Sep 17 00:00:00 2001 From: neil Date: Sat, 8 Oct 2011 21:18:55 +0000 Subject: [PATCH] Check that unit isn't NULL before using it, which could happen if card is removed during initialisation. Thanks to Toni Wilen for spotting this. git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@41788 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- workbench/devs/networks/etherlink3/pccard.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/workbench/devs/networks/etherlink3/pccard.c b/workbench/devs/networks/etherlink3/pccard.c index ef524ef17e..4a32b8fddb 100644 --- a/workbench/devs/networks/etherlink3/pccard.c +++ b/workbench/devs/networks/etherlink3/pccard.c @@ -1,6 +1,6 @@ /* -Copyright (C) 2000-2008 Neil Cafferkey +Copyright (C) 2000-2011 Neil Cafferkey This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -736,12 +736,16 @@ static VOID CardRemovedInt(REG(a1, struct BusContext *context), /* Record loss of card and get our task to call ReleaseCard() */ unit = context->unit; - base = unit->device; - if((unit->flags & UNITF_ONLINE) != 0) - unit->flags |= UNITF_WASONLINE; - unit->flags &= ~(UNITF_HAVEADAPTER | UNITF_ONLINE); + if(unit != NULL) + { + base = unit->device; + if((unit->flags & UNITF_ONLINE) != 0) + unit->flags |= UNITF_WASONLINE; + unit->flags &= ~(UNITF_HAVEADAPTER | UNITF_ONLINE); + } context->have_card = FALSE; - Signal(unit->task, unit->card_removed_signal); + if(unit != NULL) + Signal(unit->task, unit->card_removed_signal); return; } -- 2.11.4.GIT