[rygel/wip/phako/remove-warnings: 2/14] core: Rework potential null access
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel/wip/phako/remove-warnings: 2/14] core: Rework potential null access
- Date: Thu, 13 Feb 2020 23:44:27 +0000 (UTC)
commit 1e2de70486f70b1f17f0e9aa69c7242b9fd8fe4c
Author: Jens Georg <mail jensge org>
Date: Thu Feb 13 22:09:49 2020 +0100
core: Rework potential null access
src/librygel-core/rygel-basic-management.vala | 53 ++++++++++++++++++---------
1 file changed, 35 insertions(+), 18 deletions(-)
---
diff --git a/src/librygel-core/rygel-basic-management.vala b/src/librygel-core/rygel-basic-management.vala
index 683ce50f..0e498a76 100644
--- a/src/librygel-core/rygel-basic-management.vala
+++ b/src/librygel-core/rygel-basic-management.vala
@@ -278,19 +278,24 @@ public class Rygel.BasicManagement : Service {
if (!this.ensure_test_exists (action, out bm_test)) {
return;
}
+ var ping = bm_test as BasicManagementTestPing;
+ if (ping == null) {
+ action.return_error (707, _("Wrong Test Type"));
+
+ return;
+ }
string status, additional_info;
uint success_count, failure_count;
uint32 avg_response_time, min_response_time, max_response_time;
- (bm_test as BasicManagementTestPing).get_results
- (out status,
- out additional_info,
- out success_count,
- out failure_count,
- out avg_response_time,
- out min_response_time,
- out max_response_time);
+ ping.get_results (out status,
+ out additional_info,
+ out success_count,
+ out failure_count,
+ out avg_response_time,
+ out min_response_time,
+ out max_response_time);
action.set ("Status",
typeof (string),
@@ -372,14 +377,20 @@ public class Rygel.BasicManagement : Service {
return;
}
+ var nslookup = bm_test as BasicManagementTestNSLookup;
+ if (nslookup == null) {
+ action.return_error (707, _("Wrong Test Type"));
+
+ return;
+ }
+
string status, additional_info, result;
uint success_count;
- (bm_test as BasicManagementTestNSLookup).get_results
- (out status,
- out additional_info,
- out success_count,
- out result);
+ nslookup.get_results (out status,
+ out additional_info,
+ out success_count,
+ out result);
action.set ("Status",
typeof (string),
@@ -455,14 +466,20 @@ public class Rygel.BasicManagement : Service {
return;
}
+ var traceroute = bm_test as BasicManagementTestTraceroute;
+ if (traceroute == null) {
+ action.return_error (707, _("Wrong Test Type"));
+
+ return;
+ }
+
string status, additional_info, hop_hosts;
uint32 response_time;
- (bm_test as BasicManagementTestTraceroute).get_results
- (out status,
- out additional_info,
- out response_time,
- out hop_hosts);
+ traceroute.get_results (out status,
+ out additional_info,
+ out response_time,
+ out hop_hosts);
action.set ("Status",
typeof (string),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]