Skip to content
Snippets Groups Projects
Commit d227640c authored by stepan's avatar stepan
Browse files

More robustness and informative errors in grid

parent df561817
No related branches found
No related tags found
No related merge requests found
......@@ -98,11 +98,12 @@ public final class GridContext {
}
public void setCurrentDevice(String name, GridDevice currentDevice, String filenamePattern) {
assert devices.size() == RGridGraphicsAdapter.getDevicesCount() : devices.size() + " vs " + RGridGraphicsAdapter.getDevicesCount();
RGridGraphicsAdapter.addDevice(name);
RGridGraphicsAdapter.setCurrentDevice(name);
currentDeviceIdx = this.devices.size();
this.devices.add(new DeviceAndState(currentDevice, filenamePattern));
assert devices.size() == RGridGraphicsAdapter.getDevicesCount();
assert devices.size() == RGridGraphicsAdapter.getDevicesCount() : devices.size() + " vs " + RGridGraphicsAdapter.getDevicesCount();
}
public void openDefaultDevice() {
......
......@@ -221,7 +221,7 @@ public final class Unit {
case STRINGWIDTH:
case MYSTRINGWIDTH:
str = RRuntime.asString(data.getDataAt(0));
return value * GridUtils.getStringWidth(ctx.gpar.getDrawingContext(index), ctx.device, str);
return value * GridUtils.getStringWidth(ctx.gpar.getDrawingContext(index), ctx.device, str == null ? "" : str);
case STRINGHEIGHT:
case MYSTRINGHEIGHT:
str = RRuntime.asString(data.getDataAt(0));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment