now depending on how the coder wanted this to work
since the comment says it its self the index can be -1
then the current code would not even cover it being -1
well no in all possible ways.
Compiler* CompilerFactory::GetCompiler(size_t index)
{
// NOTE: The index can be -1 , if there is no compiler at all or less than number of compilers.
if ((Compilers.GetCount() < 1) || ((index + 1) > Compilers.GetCount()))
return 0;
return Compilers[index];
}
when you select from the drop down the project you want to build and then you right click
on a project in the project tree size_t index is -1 yet the number of compilers are not from
Compilers.GetCount()
now depending on how you guys want it which i would like to know.
it could look like this.
Compiler* CompilerFactory::GetCompiler(size_t index)
{
// NOTE: The index can be -1 , if there is no compiler at all or less than number of compilers.
if (index < 1 || (Compilers.GetCount() < 1) || ((index + 1) > Compilers.GetCount()))
return 0;
//cbMessageBox(wxString::Format(_("Index: %d"),index));
return Compilers[index];
}
or it could work like this.
Compiler* CompilerFactory::GetCompiler(size_t index)
{
// NOTE: The index can be -1 , if there is no compiler at all or less than number of compilers.
if ((Compilers.GetCount() < 1) || ((index + 1) > Compilers.GetCount()))
return 0;
//the index can be -1
else if(index < 0 && !((Compilers.GetCount() < 1) || ((index + 1) > Compilers.GetCount())))
return GetDefaultCompiler();
//cbMessageBox(wxString::Format(_("Index: %d"),index));
return Compilers[index];
}
since i have already had a comment on my patches being crap. which some where.
im gun shy of posting patchs.
and i dont really want to just be a bug poster lacky and let you guys do all the work.