From 7b07bcaf449ea6cf52c2ac501e48cddbe4bde035 Mon Sep 17 00:00:00 2001 From: Hubert Jarosz Date: Tue, 1 Mar 2016 00:08:33 +0100 Subject: fix six possible "divide by zero" --- tools/editor/plugins/editor_preview_plugins.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tools/editor/plugins/editor_preview_plugins.cpp') diff --git a/tools/editor/plugins/editor_preview_plugins.cpp b/tools/editor/plugins/editor_preview_plugins.cpp index f3b527257..12d50cd4b 100644 --- a/tools/editor/plugins/editor_preview_plugins.cpp +++ b/tools/editor/plugins/editor_preview_plugins.cpp @@ -725,7 +725,11 @@ Ref EditorSamplePreviewPlugin::generate(const RES& p_from) { } else { half=1; ofs=h/2; - v = ((j-(h/2))/(float)(h/2)) * 2.0 - 1.0; + if( (float)(h/2) != 0 ) { + v = ((j-(h/2))/(float)(h/2)) * 2.0 - 1.0; + } else { + v = ((j-(h/2))/(float)(1/2)) * 2.0 - 1.0; + } } uint8_t* imgofs = &imgw[(j*w+i)*3]; -- cgit v1.2.3-70-g09d2