emacs command was referencing uninitialized values
Fixes 7B54CF80-45A4-4D50-A8D3-63272D60FA1B
This commit is contained in:
parent
57abfd7ef8
commit
8d4de77836
1 changed files with 13 additions and 6 deletions
19
src/emacs.cc
19
src/emacs.cc
|
|
@ -40,18 +40,21 @@ namespace ledger {
|
||||||
|
|
||||||
void format_emacs_posts::write_xact(xact_t& xact)
|
void format_emacs_posts::write_xact(xact_t& xact)
|
||||||
{
|
{
|
||||||
out << "\"" << xact.pos->pathname << "\" "
|
if (xact.pos)
|
||||||
<< xact.pos->beg_line << " ";
|
out << "\"" << xact.pos->pathname << "\" "
|
||||||
|
<< xact.pos->beg_line << " ";
|
||||||
|
else
|
||||||
|
out << "\"\" " << -1 << " ";
|
||||||
|
|
||||||
tm when = gregorian::to_tm(xact.date());
|
tm when = gregorian::to_tm(xact.date());
|
||||||
std::time_t date = std::mktime(&when);
|
std::time_t date = std::mktime(&when);
|
||||||
|
|
||||||
out << "(" << (date / 65536) << " " << (date % 65536) << " 0) ";
|
out << "(" << (date / 65536) << " " << (date % 65536) << " 0) ";
|
||||||
|
|
||||||
if (! xact.code)
|
if (xact.code)
|
||||||
out << "nil ";
|
|
||||||
else
|
|
||||||
out << "\"" << *xact.code << "\" ";
|
out << "\"" << *xact.code << "\" ";
|
||||||
|
else
|
||||||
|
out << "nil ";
|
||||||
|
|
||||||
if (xact.payee.empty())
|
if (xact.payee.empty())
|
||||||
out << "nil";
|
out << "nil";
|
||||||
|
|
@ -77,7 +80,11 @@ void format_emacs_posts::operator()(post_t& post)
|
||||||
out << "\n";
|
out << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
out << " (" << post.pos->beg_line << " ";
|
if (post.pos)
|
||||||
|
out << " (" << post.pos->beg_line << " ";
|
||||||
|
else
|
||||||
|
out << " (" << -1 << " ";
|
||||||
|
|
||||||
out << "\"" << post.reported_account()->fullname() << "\" \""
|
out << "\"" << post.reported_account()->fullname() << "\" \""
|
||||||
<< post.amount << "\"";
|
<< post.amount << "\"";
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue