lib/fog/aliyun/models/compute/image.rb in fog-aliyun-0.3.3 vs lib/fog/aliyun/models/compute/image.rb in fog-aliyun-0.3.4

- old
+ new

@@ -27,10 +27,12 @@ attribute :platform, aliases: 'Platform' attribute :size, aliases: 'Size' attribute :snapshot_id, aliases: 'SnapshotId' def initialize(attributes) - self.snapshot_id = attributes['DiskDeviceMappings']['DiskDeviceMapping'][0]['SnapshotId'] + unless attributes['DiskDeviceMappings']['DiskDeviceMapping'].empty? + self.snapshot_id = attributes['DiskDeviceMappings']['DiskDeviceMapping'][0]['SnapshotId'] + end super end def save(options = {}) requires :snapshot_id