From: joncruz Date: Sat, 8 Apr 2006 09:51:35 +0000 (+0000) Subject: Fixed array index calculation X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c879fdcc23d547db88270136480d08c5a13da9ff;p=inkscape.git Fixed array index calculation --- diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index 61c642989..5ad93a1b7 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -415,7 +415,8 @@ static int sp_icon_get_phys_size(int size) GTK_ICON_SIZE_MENU }; for (unsigned i = 0; i < G_N_ELEMENTS(gtkSizes) && init; ++i) { - unsigned const val_ix(gtkSizes[i]); + guint const val_ix = (gtkSizes[i] <= GTK_ICON_SIZE_DIALOG) ? (guint)gtkSizes[i] : (guint)Inkscape::ICON_SIZE_DECORATION; + g_assert( val_ix < G_N_ELEMENTS(vals) ); gint width = 0; @@ -459,7 +460,8 @@ static int sp_icon_get_phys_size(int size) GtkWidget *icon = (GtkWidget *)g_object_new(SP_TYPE_ICON, NULL); for (unsigned i = 0; i < G_N_ELEMENTS(gtkSizes); ++i) { - unsigned const val_ix(gtkSizes[i]); + guint const val_ix = (gtkSizes[i] <= GTK_ICON_SIZE_DIALOG) ? (guint)gtkSizes[i] : (guint)Inkscape::ICON_SIZE_DECORATION; + g_assert( val_ix < G_N_ELEMENTS(vals) ); gint width = 0;