From 6975f4b350aabc3d43433401070a03facce47ea1 Mon Sep 17 00:00:00 2001
From: Arvid Norberg <arvid@libtorrent.org>
Date: Sat, 10 Apr 2010 04:58:43 +0000
Subject: [PATCH] fixed typo in asking for available amount of memory

---
 src/disk_io_thread.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/disk_io_thread.cpp b/src/disk_io_thread.cpp
index 48599d534..2d8b4e8d0 100644
--- a/src/disk_io_thread.cpp
+++ b/src/disk_io_thread.cpp
@@ -318,6 +318,7 @@ namespace libtorrent
 			m_physical_ram = 0;
 #elif defined TORRENT_WINDOWS
 		MEMORYSTATUSEX ms;
+		ms.dwLength = sizeof(MEMORYSTATUSEX);
 		if (GlobalMemoryStatusEx(&ms))
 			m_physical_ram = ms.ullTotalPhys;
 		else
@@ -1583,7 +1584,9 @@ namespace libtorrent
 					elevator_direction = -1;
 					--elevator_job_pos;
 				}
+				TORRENT_ASSERT(!sorted_read_jobs.empty());
 
+				TORRENT_ASSERT(elevator_job_pos != sorted_read_jobs.end());
 				j = elevator_job_pos->second;
 				read_jobs_t::iterator to_erase = elevator_job_pos;