error protection for Get functions

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4278 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
shatty 2003-08-13 10:12:46 +00:00
parent 5c78d8ec9e
commit 884d2b83a6
1 changed files with 9 additions and 0 deletions

View File

@ -54,18 +54,27 @@ BCharacterSetRoster::StopWatching(BMessenger target)
const BCharacterSet *
BCharacterSetRoster::GetCharacterSetByFontID(uint32 id)
{
if ((id < 0) || (id >= character_sets_by_id_count)) {
return NULL;
}
return character_sets_by_id[id];
}
const BCharacterSet *
BCharacterSetRoster::GetCharacterSetByConversionID(uint32 id)
{
if ((id+1 < 0) || (id+1 >= character_sets_by_id_count)) {
return NULL;
}
return character_sets_by_id[id+1];
}
const BCharacterSet *
BCharacterSetRoster::GetCharacterSetByMIBenum(uint32 MIBenum)
{
if ((MIBenum < 0) || (MIBenum > maximum_valid_MIBenum)) {
return NULL;
}
return character_sets_by_MIBenum[MIBenum];
}