This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- int pc = rint (p * 100);
- if (pc == 100) {
- /* 100% makes it sound like we've finished when we haven't */
- pc = 99;
- }
-
- stringstream s;
- if (!finished ()) {
+ SafeStringStream s;
+ if (!finished () && p) {
+ int pc = rint (p.get() * 100);
+ if (pc == 100) {
+ /* 100% makes it sound like we've finished when we haven't */
+ pc = 99;
+ }
+
/// TRANSLATORS: remaining here follows an amount of time that is remaining
/// on an operation.
s << "; " << seconds_to_approximate_hms (r) << " " << _("remaining");
/// TRANSLATORS: remaining here follows an amount of time that is remaining
/// on an operation.
s << "; " << seconds_to_approximate_hms (r) << " " << _("remaining");
} else if (finished_ok ()) {
s << String::compose (_("OK (ran for %1)"), seconds_to_hms (_ran_for));
} else if (finished_in_error ()) {
} else if (finished_ok ()) {
s << String::compose (_("OK (ran for %1)"), seconds_to_hms (_ran_for));
} else if (finished_in_error ()) {