[gnome-shell] dnd: Prevent dividing by zero when calculating the scale factor



commit 703187e99620de085978954fe3a3004676de1046
Author: Mario Sanchez Prada <mario endlessm com>
Date:   Fri Jun 30 01:22:42 2017 +0000

    dnd: Prevent dividing by zero when calculating the scale factor
    
    This ensures that we snap back to the correct size when the
    source actor has been scaled to 0.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=787901

 js/ui/dnd.js |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/dnd.js b/js/ui/dnd.js
index 64c1eb5..a64915b 100644
--- a/js/ui/dnd.js
+++ b/js/ui/dnd.js
@@ -531,7 +531,7 @@ var _Draggable = new Lang.Class({
             // Snap the clone back to its source
             [x, y] = this._dragActorSource.get_transformed_position();
             let [sourceScaledWidth, sourceScaledHeight] = this._dragActorSource.get_transformed_size();
-            scale = this._dragActor.width / sourceScaledWidth;
+            scale = sourceScaledWidth ? this._dragActor.width / sourceScaledWidth : 0;
         } else if (this._dragOrigParent) {
             // Snap the actor back to its original position within
             // its parent, adjusting for the fact that the parent


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]