Check source parameter to GncQuotesImpl::report() is not null

The "source" parameter is checked once at the start before using strcmp()
but is then used later on in GncQuotesImpl::query_fq() with function calls
that can't handle null values.
This commit is contained in:
Simon Arlott 2023-06-24 11:49:29 +01:00
parent 4b83068c6b
commit fe526a6043
No known key found for this signature in database
GPG Key ID: DF001BFD83E75990

View File

@ -329,7 +329,10 @@ void
GncQuotesImpl::report (const char* source, const StrVec& commodities,
bool verbose)
{
bool is_currency{source && strcmp(source, "currency") == 0};
if (!source)
throw (GncQuoteException(bl::translate("GncQuotes::Report called with no source.")));
bool is_currency{strcmp(source, "currency") == 0};
m_failures.clear();
if (commodities.empty())
{