bugfix: Stopped freezing in configure step if an empty value is entered.

This commit is contained in:
tastytea 2018-09-20 06:23:44 +02:00
parent 4297f68d41
commit 603532a334
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 8 additions and 8 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.6) cmake_minimum_required (VERSION 3.6)
project (mastorss project (mastorss
VERSION 0.8.1 VERSION 0.8.2
LANGUAGES CXX LANGUAGES CXX
) )

View File

@ -65,7 +65,7 @@ std::uint16_t read_config(string &instance, string &access_token, string &feedur
if (instance.empty()) if (instance.empty())
{ {
cout << "Instance: "; cout << "Instance: ";
cin >> instance; std::getline(cin, instance);
config[profile]["instance"] = instance; config[profile]["instance"] = instance;
config_changed = true; config_changed = true;
} }
@ -86,7 +86,7 @@ std::uint16_t read_config(string &instance, string &access_token, string &feedur
string code; string code;
cout << "Visit " << url << " to authorize this application.\n"; cout << "Visit " << url << " to authorize this application.\n";
cout << "Insert code: "; cout << "Insert code: ";
cin >> code; std::getline(cin, code);
ret = masto.register_app2(client_id, ret = masto.register_app2(client_id,
client_secret, client_secret,
@ -114,7 +114,7 @@ std::uint16_t read_config(string &instance, string &access_token, string &feedur
if (feedurl.empty()) if (feedurl.empty())
{ {
cout << "feedurl: "; cout << "feedurl: ";
cin >> feedurl; std::getline(cin, feedurl);
config[profile]["feedurl"] = feedurl; config[profile]["feedurl"] = feedurl;
config_changed = true; config_changed = true;
} }
@ -122,7 +122,7 @@ std::uint16_t read_config(string &instance, string &access_token, string &feedur
{ {
string titles_only; string titles_only;
cout << "post only titles? [y/n]: "; cout << "post only titles? [y/n]: ";
cin >> titles_only; std::getline(cin, titles_only);
if (titles_only[0] == 'y') if (titles_only[0] == 'y')
{ {
config[profile]["titles_only"] = true; config[profile]["titles_only"] = true;
@ -137,7 +137,7 @@ std::uint16_t read_config(string &instance, string &access_token, string &feedur
{ {
string titles_as_cw; string titles_as_cw;
cout << "Use titles as CW? [y/n]: "; cout << "Use titles as CW? [y/n]: ";
cin >> titles_as_cw; std::getline(cin, titles_as_cw);
if (titles_as_cw[0] == 'y') if (titles_as_cw[0] == 'y')
{ {
config[profile]["titles_as_cw"] = true; config[profile]["titles_as_cw"] = true;
@ -152,7 +152,7 @@ std::uint16_t read_config(string &instance, string &access_token, string &feedur
{ {
string append; string append;
cout << "Append this string to each post []: "; cout << "Append this string to each post []: ";
cin >> append; std::getline(cin, append);
config[profile]["append"] = append; config[profile]["append"] = append;
config_changed = true; config_changed = true;
} }
@ -160,7 +160,7 @@ std::uint16_t read_config(string &instance, string &access_token, string &feedur
{ {
string interval; string interval;
cout << "Interval between posts in seconds [60]: "; cout << "Interval between posts in seconds [60]: ";
cin >> interval; std::getline(cin, interval);
if (interval.empty()) if (interval.empty())
{ {
interval = "60"; interval = "60";