Detect Null pointer. Assert if null, else don't crash here. Bug 97887.

This commit is contained in:
nelsonb%netscape.com 2001-09-06 00:49:39 +00:00
Родитель be79e5badd
Коммит e6d688e56a
1 изменённых файлов: 14 добавлений и 3 удалений

Просмотреть файл

@ -2121,15 +2121,26 @@ PK11_NeedUserInit(PK11SlotInfo *slot)
PK11SlotInfo *
PK11_GetInternalKeySlot(void)
{
SECMODModule *mod = SECMOD_GetInternalModule();
return PK11_ReferenceSlot(mod->isFIPS ? mod->slots[0] : mod->slots[1]);
SECMODModule *mod = SECMOD_GetInternalModule();
PORT_Assert(mod != NULL);
if (!mod) {
PORT_SetError( SEC_ERROR_NO_MODULE );
return NULL;
}
return PK11_ReferenceSlot(mod->isFIPS ? mod->slots[0] : mod->slots[1]);
}
/* get the internal default slot */
PK11SlotInfo *
PK11_GetInternalSlot(void)
{
return PK11_ReferenceSlot(SECMOD_GetInternalModule()->slots[0]);
SECMODModule * mod = SECMOD_GetInternalModule();
PORT_Assert(mod != NULL);
if (!mod) {
PORT_SetError( SEC_ERROR_NO_MODULE );
return NULL;
}
return PK11_ReferenceSlot(mod->slots[0]);
}
/*