[gnome-usage] app-item: Drop useless try-catch blocks
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-usage] app-item: Drop useless try-catch blocks
- Date: Fri, 3 Dec 2021 11:39:16 +0000 (UTC)
commit f0b356584c5b277819d23e173ea0cf1e4e031bc8
Author: Adrien Plazas <kekun plazas laposte net>
Date: Fri Dec 3 12:30:04 2021 +0100
app-item: Drop useless try-catch blocks
There was no error to catch.
src/app-item.vala | 24 ++++++++++--------------
1 file changed, 10 insertions(+), 14 deletions(-)
---
diff --git a/src/app-item.vala b/src/app-item.vala
index 53296e4..c7e70f0 100644
--- a/src/app-item.vala
+++ b/src/app-item.vala
@@ -72,20 +72,16 @@ namespace Usage {
* .scope units we fetch the second to last dashed item,
* for .service units the last (as they use @ to separate
* any required) */
- try {
- string[] segments = systemd_unit.split ("-");
-
- if (systemd_unit.has_suffix (".scope") && segments.length >= 2) {
- escaped_id = segments[segments.length - 2];
- } else if (systemd_unit.has_suffix (".service") && segments.length >= 1) {
- string tmp = segments[segments.length - 1];
- /* Strip .service */
- tmp = tmp[0:tmp.length-8];
- /* Remove any @ element (if there) */
- escaped_id = tmp.split("@", 2)[0];
- }
- } catch (Error e) {
- return null;
+ string[] segments = systemd_unit.split ("-");
+
+ if (systemd_unit.has_suffix (".scope") && segments.length >= 2) {
+ escaped_id = segments[segments.length - 2];
+ } else if (systemd_unit.has_suffix (".service") && segments.length >= 1) {
+ string tmp = segments[segments.length - 1];
+ /* Strip .service */
+ tmp = tmp[0:tmp.length-8];
+ /* Remove any @ element (if there) */
+ escaped_id = tmp.split("@", 2)[0];
}
if (escaped_id == null)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]