Fossil SCM
Have the TH1 combobox command fail with a script error when its TEXT-LIST argument is not a well-formed list, instead of using the unset results of Th_SplitList().
Commit
6bcb3a6c4557f7f8d12cd830d971e088b99556fa1208c89fb3dab940c77681e2
Parent
eac7c5f36ccb5ee…
1 file changed
+4
-1
+4
-1
| --- src/th_main.c | ||
| +++ src/th_main.c | ||
| @@ -1132,11 +1132,14 @@ | ||
| 1132 | 1132 | int *aszElem; |
| 1133 | 1133 | char **azElem; |
| 1134 | 1134 | int i; |
| 1135 | 1135 | |
| 1136 | 1136 | if( Th_ToInt(interp, argv[3], argl[3], &height) ) return TH_ERROR; |
| 1137 | - Th_SplitList(interp, argv[2], TH1_LEN(argl[2]), &azElem, &aszElem, &nElem); | |
| 1137 | + if( Th_SplitList(interp, argv[2], TH1_LEN(argl[2]), | |
| 1138 | + &azElem, &aszElem, &nElem) ){ | |
| 1139 | + return TH_ERROR; | |
| 1140 | + } | |
| 1138 | 1141 | blob_init(&name, (char*)argv[1], TH1_LEN(argl[1])); |
| 1139 | 1142 | zValue = Th_Fetch(blob_str(&name), &nValue); |
| 1140 | 1143 | nValue = TH1_LEN(nValue); |
| 1141 | 1144 | zH = htmlize(blob_buffer(&name), blob_size(&name)); |
| 1142 | 1145 | z = mprintf("<select id=\"%s\" name=\"%s\" size=\"%d\">", zH, zH, height); |
| 1143 | 1146 |
| --- src/th_main.c | |
| +++ src/th_main.c | |
| @@ -1132,11 +1132,14 @@ | |
| 1132 | int *aszElem; |
| 1133 | char **azElem; |
| 1134 | int i; |
| 1135 | |
| 1136 | if( Th_ToInt(interp, argv[3], argl[3], &height) ) return TH_ERROR; |
| 1137 | Th_SplitList(interp, argv[2], TH1_LEN(argl[2]), &azElem, &aszElem, &nElem); |
| 1138 | blob_init(&name, (char*)argv[1], TH1_LEN(argl[1])); |
| 1139 | zValue = Th_Fetch(blob_str(&name), &nValue); |
| 1140 | nValue = TH1_LEN(nValue); |
| 1141 | zH = htmlize(blob_buffer(&name), blob_size(&name)); |
| 1142 | z = mprintf("<select id=\"%s\" name=\"%s\" size=\"%d\">", zH, zH, height); |
| 1143 |
| --- src/th_main.c | |
| +++ src/th_main.c | |
| @@ -1132,11 +1132,14 @@ | |
| 1132 | int *aszElem; |
| 1133 | char **azElem; |
| 1134 | int i; |
| 1135 | |
| 1136 | if( Th_ToInt(interp, argv[3], argl[3], &height) ) return TH_ERROR; |
| 1137 | if( Th_SplitList(interp, argv[2], TH1_LEN(argl[2]), |
| 1138 | &azElem, &aszElem, &nElem) ){ |
| 1139 | return TH_ERROR; |
| 1140 | } |
| 1141 | blob_init(&name, (char*)argv[1], TH1_LEN(argl[1])); |
| 1142 | zValue = Th_Fetch(blob_str(&name), &nValue); |
| 1143 | nValue = TH1_LEN(nValue); |
| 1144 | zH = htmlize(blob_buffer(&name), blob_size(&name)); |
| 1145 | z = mprintf("<select id=\"%s\" name=\"%s\" size=\"%d\">", zH, zH, height); |
| 1146 |