fix #2722, make sure that the file is open b4 G

This commit is contained in:
Jeffrey Crowell 2015-06-12 15:47:08 -04:00
parent f80f4da65f
commit ba8a2983e1

View File

@ -1056,23 +1056,27 @@ R_API int r_core_visual_cmd(RCore *core, int ch) {
case 'G':
ret = 0;
int scols = r_config_get_i (core->config, "hex.cols");
if (core->io->va) {
ut64 offset = r_io_section_get_vaddr (core->io, 0);
if (offset == UT64_MAX) {
offset = r_io_desc_size (core->io,
core->file->desc)
- core->blocksize + 2*scols;
ret = r_core_seek (core, offset, 1);
if (core->file) {
if (core->io->va) {
ut64 offset = r_io_section_get_vaddr (core->io, 0);
if (offset == UT64_MAX) {
offset = r_io_desc_size (core->io,
core->file->desc)
- core->blocksize + 2*scols;
ret = r_core_seek (core, offset, 1);
} else {
offset += r_io_desc_size (core->io,
core->file->desc)
- core->blocksize + 2*scols;
ret = r_core_seek (core, offset, 1);
}
} else {
offset += r_io_desc_size (core->io,
core->file->desc)
- core->blocksize + 2*scols;
ret = r_core_seek (core, offset, 1);
ret = r_core_seek (core,
r_io_desc_size (core->io, core->file->desc)
- core->blocksize + 2*scols, 1);
}
} else {
ret = r_core_seek (core,
r_io_desc_size (core->io, core->file->desc)
- core->blocksize + 2*scols, 1);
ret = -1;
}
if (ret != -1)
r_io_sundo_push (core->io, core->offset);