[banshee] Gio: bail from foreach iteration after finding null (bgo#721203)
- From: Andrés Aragoneses <aaragoneses src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] Gio: bail from foreach iteration after finding null (bgo#721203)
- Date: Sun, 29 Dec 2013 21:03:17 +0000 (UTC)
commit 9d1ebf928edc793ba240603a3187f081b5d063d8
Author: Andrés G. Aragoneses <knocte gmail com>
Date: Sun Dec 29 22:03:08 2013 +0100
Gio: bail from foreach iteration after finding null (bgo#721203)
Previous commit [1] didn't take in account that a 'yield return'
is not equivalent to a 'return' statement with regards to loops
(the latter will exit the loop, but not the former). So we need
to pass to the next iteration of the loop manually via `continue`
in every case where we want to discard creating a new Volume
object because of finding unwanted null collaborators.
https://git.gnome.org/browse/banshee/commit/?id=20bacf9a3d06b2d136b474319f0b8224947bc4b8
.../LowLevel/RawBlockDevice.cs | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/src/Backends/Banshee.Gio/Banshee.Hardware.Gio/LowLevel/RawBlockDevice.cs
b/src/Backends/Banshee.Gio/Banshee.Hardware.Gio/LowLevel/RawBlockDevice.cs
index 51cb559..73448c6 100644
--- a/src/Backends/Banshee.Gio/Banshee.Hardware.Gio/LowLevel/RawBlockDevice.cs
+++ b/src/Backends/Banshee.Gio/Banshee.Hardware.Gio/LowLevel/RawBlockDevice.cs
@@ -47,10 +47,12 @@ namespace Banshee.Hardware.Gio
var volume = GLib.VolumeAdapter.GetObject (notVolume as GLib.Object);
if (volume == null) {
yield return null;
+ continue;
}
var device = Manager.GudevDeviceFromGioVolume (volume);
if (device == null) {
yield return null;
+ continue;
}
yield return new Volume (new RawVolume (volume,
Manager,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]