diff options
| author | tassaron | 2017-08-27 09:53:18 -0400 |
|---|---|---|
| committer | tassaron | 2017-08-27 09:53:18 -0400 |
| commit | e8a7b18293768497df272bb4cb64b678d57f58da (patch) | |
| tree | 3f5d50d3ee2856ba11ed3d83f3d208322ab7991b /src/component.py | |
| parent | 85d3b779d07ad92b0f540ea52185777c3c3f5e48 (diff) | |
disallow suspiciously enormous floats
this stops a bad project file from crashing my computer...
Diffstat (limited to 'src/component.py')
| -rw-r--r-- | src/component.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/component.py b/src/component.py index de4b6a7..01c1d06 100644 --- a/src/component.py +++ b/src/component.py @@ -390,7 +390,7 @@ class Component(QtCore.QObject, metaclass=ComponentMetaclass): self.settings = parent.settings log.verbose( 'Creating UI for %s #%s\'s widget', - self.name, self.compPos + self.__class__.name, self.compPos ) self.page = self.loadUi(self.__class__.ui) @@ -533,7 +533,8 @@ class Component(QtCore.QObject, metaclass=ComponentMetaclass): else: # Normal tracked widget setattr(self, attr, val) - log.verbose('Setting %s self.%s to %s' % (self.name, attr, val)) + log.verbose('Setting %s self.%s to %s' % ( + self.__class__.name, attr, val)) def setWidgetValues(self, attrDict): ''' @@ -698,6 +699,12 @@ class Component(QtCore.QObject, metaclass=ComponentMetaclass): def pixelValForAttr(self, attr, val=None, **kwargs): if val is None: val = self._relativeValues[attr] + if val > 50.0: + log.warning( + '%s #%s attempted to set %s to dangerously high number %s', + self.__class__.name, self.compPos, attr, val + ) + val = 50.0 result = math.ceil(kwargs['axis'] * val) log.verbose( 'Converting %s: f%s to px%s using axis %s', @@ -748,7 +755,7 @@ class Component(QtCore.QObject, metaclass=ComponentMetaclass): # means the pixel value needs to be updated log.debug( 'Updating %s #%s\'s relative widget: %s', - self.name, self.compPos, attr) + self.__class__.name, self.compPos, attr) with blockSignals(self._trackedWidgets[attr]): self.updateRelativeWidgetMaximum(attr) pixelVal = self.pixelValForAttr(attr, oldRelativeVal) |
