Skip to content

Commit

Permalink
Fixed #31: added check for valid index before displaying comment
Browse files Browse the repository at this point in the history
  • Loading branch information
robmcmullen committed Apr 11, 2016
1 parent 3e6b124 commit 1febd1f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion omnivore/_omnivore_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = "0.9.2"
version = "0.9.3"
13 changes: 8 additions & 5 deletions omnivore/tasks/hex_edit/disassembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,14 @@ def set_grid_cell_attr(self, grid, col, attr):

def get_index_range(self, r, c):
try:
line = self.lines[r]
except:
line = self.lines[-1]
index = line[0] - self.start_addr
return index, index + line[4]
try:
line = self.lines[r]
except:
line = self.lines[-1]
index = line[0] - self.start_addr
return index, index + line[4]
except IndexError:
return 0, 0

def is_index_valid(self, index):
return index < len(self.segment)
Expand Down
7 changes: 4 additions & 3 deletions omnivore/utils/wx/bytegrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,9 +755,10 @@ def on_motion_update_status(self, evt):
row = self.YToRow(y)
col = self.XToCol(x)
index, _ = self.table.get_index_range(row, col)
label = self.table.get_label_at_index(index)
message = self.get_status_message_at_index(index, row, col)
self.editor.task.status_bar.message = "%s: %s %s" % (self.short_name, label, message)
if self.table.is_index_valid(index):
label = self.table.get_label_at_index(index)
message = self.get_status_message_at_index(index, row, col)
self.editor.task.status_bar.message = "%s: %s %s" % (self.short_name, label, message)

def get_status_message_at_index(self, index, row, col):
return "r=%d,c=%d" % (row, col)
Expand Down

0 comments on commit 1febd1f

Please sign in to comment.