From b74eb68c048d9f9d0f56a1e3082e8b60eb38924c Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Wed, 22 Aug 2018 09:33:47 +0100 Subject: [PATCH] Pull the check on layer names out so that DataLayerInterface types get it as well. --- volatility/framework/interfaces/layers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/volatility/framework/interfaces/layers.py b/volatility/framework/interfaces/layers.py index fcf51476b..68e4f947c 100644 --- a/volatility/framework/interfaces/layers.py +++ b/volatility/framework/interfaces/layers.py @@ -423,9 +423,9 @@ class Memory(validity.ValidityRoutines, collections.abc.Mapping): This will throw an exception if the required dependencies are not met """ self._check_type(layer, DataLayerInterface) + if layer.name in self._layers: + raise exceptions.LayerException("Layer already exists: {}".format(layer.name)) if isinstance(layer, TranslationLayerInterface): - if layer.name in self._layers: - raise exceptions.LayerException("Layer already exists: {}".format(layer.name)) missing_list = [sublayer for sublayer in layer.dependencies if sublayer not in self._layers] if missing_list: raise exceptions.LayerException(