Crash:
Program received signal SIGSEGV, Segmentation fault.
0xb7f80178 in std::string::assign(char const*, unsigned int) () from /usr/lib/libstdc++.so.6
(gdb) bt
#0 0xb7f80178 in std::string::assign(char const*, unsigned int) () from /usr/lib/libstdc++.so.6
#1 0x081ca794 in std::string::assign (this=0x839f060) at /usr/include/c++/4.4/bits/basic_string.h:970
#2 std::string::operator= (this=0x839f060) at /usr/include/c++/4.4/bits/basic_string.h:514
#3 WorldDatabase::LoadBooks (this=0x839f060) at Items/ItemsDB.cpp:371
#4 0x081d1c4b in WorldDatabase::LoadItemList (this=0x839f060) at Items/ItemsDB.cpp:797
#5 0x081fe362 in main (argc=1, argv=0xbffff824) at net.cpp:208
Code: Select all
int32 WorldDatabase::LoadBooks()
{
DatabaseResult result;
int32 total = 0;
int32 id = 0;
if( database_new.Select(&result, "SELECT item_id, language, author, title FROM item_details_book") )
{
while( result.Next() )
{
id = result.GetInt32Str("item_id");
Item* item = master_item_list.GetItem(id);
if(item)
{
LogWrite(ITEM__DEBUG, 5, "Items", "\tItem Book for item_id %u", id);
LogWrite(ITEM__DEBUG, 5, "Items", "\ttype: %i, %i, %s, %s",
ITEM_TYPE_BOOK,
result.GetInt8Str("language"),
result.GetStringStr("author"),
result.GetStringStr("title"));
item->SetItemType(ITEM_TYPE_BOOK);
item->book_info->language = result.GetInt8Str("language");
item->book_info->author.data = result.GetStringStr("author");
item->book_info->author.size = item->book_info->author.data.length();
item->book_info->title.data = result.GetStringStr("title");
item->book_info->title.size = item->book_info->title.data.length();
total++;
}
else
LogWrite(ITEM__ERROR, 0, "Items", "Error loading `item_details_book`, ID: %i", id);
}
}
return total;
}Code: Select all
item->book_info->author.data = result.GetStringStr("author");
item->book_info->author.size = item->book_info->author.data.length();Meanwhile, I'm just going to wrap it in an if to see if the field has data before trying to stuff it. Btw, this does NOT happen on Windows. Only Linux, and until CoE, we had no data for books - so this has probably existed all along.
Input appreciated.