mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-11 07:29:38 -05:00
fixed bug when retroshare-service -U list is ran with no account
This commit is contained in:
parent
d1baa3821a
commit
481a207ccb
@ -158,6 +158,7 @@ public:
|
||||
OK, /// Everything go as expected, no error occurred
|
||||
ERR_ALREADY_RUNNING, /// Another istance is running already
|
||||
ERR_CANT_ACQUIRE_LOCK, /// Another istance is already running?
|
||||
ERR_NO_AVAILABLE_ACCOUNT, /// Used in retroshare-service -U list when no account is available
|
||||
ERR_UNKNOWN /// Unkown error, maybe password is wrong?
|
||||
};
|
||||
|
||||
|
@ -234,14 +234,19 @@ int main(int argc, char* argv[])
|
||||
{
|
||||
if(prefUserString == "list")
|
||||
{
|
||||
std::cout << std::endl << std::endl
|
||||
<< "Available accounts:" << std::endl;
|
||||
|
||||
std::vector<RsLoginHelper::Location> locations;
|
||||
rsLoginHelper->getLocations(locations);
|
||||
|
||||
int accountCountDigits = static_cast<int>(
|
||||
ceil(log(locations.size())/log(10.0)) );
|
||||
if(locations.size() == 0)
|
||||
{
|
||||
RsErr() << "No available accounts. You cannot use option -U list" << std::endl;
|
||||
return -RsInit::ERR_NO_AVAILABLE_ACCOUNT;
|
||||
}
|
||||
|
||||
std::cout << std::endl << std::endl
|
||||
<< "Available accounts:" << std::endl;
|
||||
|
||||
int accountCountDigits = static_cast<int>( ceil(log(locations.size())/log(10.0)) );
|
||||
|
||||
for( uint32_t i=0; i<locations.size(); ++i )
|
||||
std::cout << "[" << std::setw(accountCountDigits)
|
||||
|
Loading…
Reference in New Issue
Block a user