×
Namespaces

Variants
Actions

Icon creation panics if out of bounds

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Compatibility
Platform(s):
FNWiki
Article
Created: otsov (13 Nov 2007)
Last edited: hamishwillee (26 Jul 2012)


ID Unofficial - No ID assigned Creation date Nov 13, 2007
Platform S60 3rd Edition MR Devices Emulator
Category Symbian C++ Subcategory AknIconUtils and AknsUtils classes

Description

When trying to create an icon with both

AknIconUtils::CreateIconL()
AknsUtils::CreateIconL()

and given a .mif file which is indexed with an out-of-bound index to create an icon, a panic "AknIcon 5" appears.

This might also be the case with .mbm files.

Enhancement proposals

Both

AknIconUtils::CreateIconL()
AknsUtils::CreateIconL()

should not panic if given an out-of-bounds index in a .mif file. Instead, they should return an error code (see below for correct behavior).

The documentation should also include a notice about the possible panic if this is not corrected to the S60 platform.

Solution

Do not use the methods

AknIconUtils::CreateIconL()
AknsUtils::CreateIconL()

in your code if there is a danger of out-of-bounds graphic to appear in a .mif file. Instead use

CFbsBitmap* bitMapErr = new CFbsBitmap;
TInt err = bitMapErr->Load(FILENAME, IMG_ID);

to test of possible out-of-bounds conditions. The above returns correctly

KErrEof -25 End of file has been reached.

for an out-of-bounds index which can be handled by the developer.

Another option would be to add suitable accessors to test how many images there are inside a .mif file prior to invoking the icon creation functions.

 
×