Only replace m_userData in the prompt call if the user entered some legitimate data...otherwise we risk stepping on our default

value.
This commit is contained in:
mscott%netscape.com 1999-02-04 23:04:07 +00:00
Родитель 438d82553b
Коммит 1cf0713ecb
1 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -336,7 +336,11 @@ nsresult nsNntpTestDriver::PromptForUserDataAndBuildUrl(const char * userPrompt)
fgets(tempBuffer, sizeof(tempBuffer), stdin);
strip_nonprintable(tempBuffer);
PL_strcpy(m_userData, tempBuffer);
// only replace m_userData if the user actually entered a valid line...
// this allows the command function to set a default value on m_userData before
// calling this routine....
if (tempBuffer && *tempBuffer)
PL_strcpy(m_userData, tempBuffer);
return NS_OK;
}