No need to compute size of an icon if not using GUI.

This also avoids crash while calling Qimage() without GUI.
This commit is contained in:
Kornel Benko 2015-03-28 21:05:41 +01:00
parent d12920d437
commit fd7e4f2dbb

View File

@ -10,7 +10,7 @@
#include <config.h>
#include "InsetInfo.h"
#include "LyX.h"
#include "Buffer.h"
#include "BufferParams.h"
#include "BufferView.h"
@ -419,11 +419,13 @@ void InsetInfo::updateInfo()
if (!file.exists())
break;
int percent_scale = 100;
if (use_gui) {
int imgsize = QImage(toqstr(file.absFileName())).width();
if (imgsize > 0) {
int iconsize = Length(1, Length::EM).inPixels(1);
percent_scale = (100 * iconsize + imgsize / 2)/imgsize;
}
}
InsetGraphics * inset = new InsetGraphics(buffer_);
InsetGraphicsParams igp;
igp.filename = file;