[geary: 1/2] PropertyCommand: check for null before calling printf
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary: 1/2] PropertyCommand: check for null before calling printf
- Date: Thu, 10 Jan 2019 07:08:15 +0000 (UTC)
commit 0b62f6eefd5b329b1cae8a3b1611b7ba3093841b
Author: Greg V <greg@unrelenting.technology>
Date: Wed Jan 9 13:08:58 2019 +0300
PropertyCommand: check for null before calling printf
On FreeBSD, this would crash in vasprintf_l, because you're not supposed
to printf(NULL, ...).
src/client/application/application-command.vala | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/src/client/application/application-command.vala b/src/client/application/application-command.vala
index 3a21027f..1f120246 100644
--- a/src/client/application/application-command.vala
+++ b/src/client/application/application-command.vala
@@ -193,10 +193,18 @@ public class Application.PropertyCommand<T> : Application.Command {
this.object.get(this.property_name, ref this.old_value);
- this.undo_label = undo_label.printf(this.old_value);
- this.redo_label = redo_label.printf(this.new_value);
- this.executed_label = executed_label.printf(this.new_value);
- this.undone_label = undone_label.printf(this.old_value);
+ if (undo_label != null) {
+ this.undo_label = undo_label.printf(this.old_value);
+ }
+ if (redo_label != null) {
+ this.redo_label = redo_label.printf(this.new_value);
+ }
+ if (executed_label != null) {
+ this.executed_label = executed_label.printf(this.new_value);
+ }
+ if (undone_label != null) {
+ this.undone_label = undone_label.printf(this.old_value);
+ }
}
public async override void execute(GLib.Cancellable? cancellable) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]