changeset 430:d787dae8c043

Bugfixes.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 01 Jan 2007 08:09:04 +0000
parents a991d1fe7e94
children a5ebf8595154
files src/xs_fileinfo.c
diffstat 1 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/xs_fileinfo.c	Mon Jan 01 08:09:00 2007 +0000
+++ b/src/xs_fileinfo.c	Mon Jan 01 08:09:04 2007 +0000
@@ -135,7 +135,7 @@
 	tmpItem = gtk_menu_get_active(GTK_MENU(data));
 	tmpIndex = g_list_index(GTK_MENU_SHELL(data)->children, tmpItem);
 
-	if (xs_fileinfostil)
+	if (xs_fileinfostil && tmpIndex <= xs_fileinfostil->nsubTunes)
 		tmpNode = xs_fileinfostil->subTunes[tmpIndex];
 	else
 		tmpNode = NULL;
@@ -166,7 +166,6 @@
 {
 	GtkWidget *tmpMenuItem, *tmpMenu, *tmpOptionMenu;
 	t_xs_tuneinfo *tmpInfo;
-	t_xs_stil_subnode *tmpNode;
 	gint n;
 
 	/* Current implementation leaves old fileinfo window untouched if
@@ -223,16 +222,17 @@
 	/* Other menu items */
 	for (n = 1; n <= tmpInfo->nsubTunes; n++) {
 		gchar tmpStr[64];
-		if (xs_fileinfostil) {
-			g_snprintf(tmpStr, sizeof(tmpStr), _("Tune #%i: "), n);
-			
-			tmpNode = xs_fileinfostil->subTunes[n];
+		if (xs_fileinfostil && n <= xs_fileinfostil->nsubTunes) {
+			t_xs_stil_subnode *tmpNode = xs_fileinfostil->subTunes[n];
 			
-			if (tmpNode && tmpNode->pName)
-				xs_pnstrcat(tmpStr, sizeof(tmpStr), tmpNode->pName);
-			else if (tmpNode && tmpNode->pInfo)
-				xs_pnstrcat(tmpStr, sizeof(tmpStr), tmpNode->pInfo);
-			else
+			g_snprintf(tmpStr, sizeof(tmpStr), _("Tune #%i: "), n);
+
+			if (tmpNode) {
+				if (tmpNode->pName)
+					xs_pnstrcat(tmpStr, sizeof(tmpStr), tmpNode->pName);
+				else if (tmpNode->pInfo)
+					xs_pnstrcat(tmpStr, sizeof(tmpStr), tmpNode->pInfo);
+			} else
 				xs_pnstrcat(tmpStr, sizeof(tmpStr), "---");
 		} else {
 			g_snprintf(tmpStr, sizeof(tmpStr), _("Tune #%i"), n);