Skip to content

Fix crash when parsing empty files - #9

Merged
iblancasa merged 4 commits into
masterfrom
fix_emptyfiles
Dec 14, 2016
Merged

iblancasa merged 4 commits into
masterfrom
fix_emptyfiles

Conversation

@pleonex

@pleonex pleonex commented Dec 11, 2016 •

Copy link
Copy Markdown
Contributor

The script crashes when the user tried to give as input an empty file.
I have also fix some links in the Messages.md file and add two command line commands to increase verbosity from the command line in Windows and with tcsh.

@pleonex pleonex added the bug label Dec 11, 2016
@pleonex pleonex added this to the v1.2 milestone Dec 11, 2016
@pleonex pleonex self-assigned this Dec 11, 2016
@pleonex
pleonex requested a review from iblancasa December 14, 2016 10:23
Comment thread logparser/devices/inputdevices.py Outdated
return

progress = 100.0 * iteration / total
if self.progress > 0 and progress - self.progress < threshold:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

 if self.progress > 0

Should be

 if self.progress

# Based on @Greenstick's reply (https://stackoverflow.com/a/34325723)
iteration = self.stream.tell()
total = self.file_size
if total == 0:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this should be:

if not total:

But this is not enough intuitive. What do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that reading "if not total" is not intuitive. It make sense to compare against 0.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree

@iblancasa
iblancasa merged commit a054887 into master Dec 14, 2016
@pleonex
pleonex deleted the fix_emptyfiles branch December 14, 2016 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants