Index: dlgFunction.cpp =================================================================== RCS file: /projects/pgadmin3/src/ui/dlgFunction.cpp,v retrieving revision 1.35 retrieving revision 1.36 diff -Lsrc/ui/dlgFunction.cpp -Lsrc/ui/dlgFunction.cpp -u -w -r1.35 -r1.36 --- src/ui/dlgFunction.cpp +++ src/ui/dlgFunction.cpp @@ -138,7 +138,7 @@ if (objectType != PG_TRIGGERFUNCTION) { wxStringTokenizer types(function->GetArgTypes(), wxT(", ")); - int cnt=0; + size_t cnt=0; while (types.HasMoreTokens()) { @@ -146,8 +146,13 @@ if (str.IsEmpty()) continue; if (typeColNo) + { + if (cnt < function->GetArgNames().GetCount()) lstArguments->AppendItem(-1, function->GetArgNames().Item(cnt++), str); else + lstArguments->AppendItem(-1, wxEmptyString, str); + } + else lstArguments->AppendItem(-1, str); } } @@ -353,9 +358,11 @@ argNameRow = lstArguments->FindItem(-1, txtArgName->GetValue()); int pos=lstArguments->GetSelection(); - int typeno=cbDatatype->GetGuessedSelection(); - btnAdd->Enable(argNameRow < 0 && typeno >= 0); - btnChange->Enable(pos >= 0 && typeno >= 0); + + bool typeValid = (function != 0 || cbDatatype->GetGuessedSelection() >= 0); + + btnAdd->Enable(argNameRow < 0 && typeValid); + btnChange->Enable(pos >= 0 && typeValid); btnRemove->Enable(pos >= 0); }